Vue error: uncaught typeerror: Cannot Assign to read Only Property’Exports’ of object ‘# ‘ Solution

Run the previous Vue + WebPack’s Vue imitation news website small project, report error

Since the Vue study is not deep, this is always this Note, I have been looking for a long time (the exact point is a whole afternoon ^ … ^) to find the reason – V-

Uncaunht Typeerror: Cannot Assign To Read Only Property 'Exports' Of Object' #

‘Solution “>

<img src="20210911/https://img.tumi.net/wp-content/uploads/2021/09/20210911035832-613c29680f984.jpg" alt="Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’# Put the wrong file, the place where the error is wrong is such a code:

‘Solution “>

<img src="20210911/https://img.tumi.net/wp-content/uploads/2021/09/20210911035832-613c296868cf0.jpg" alt="Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#

Import {normaltime} from’ ./timeformat’;Module.exports= {NORMALTIME};
  Module.exports;  
Solution

Take Google Find, and Forum: The reason is as follows:

The code Above is ok. You can load. You can’t mix.

Translated, said that the code is not Falt, when packaging in WebPack, you can mix Require and Export in JS files. But you can’t mix Imports and

Module.exports

.

Because of WebPack 2, it is not allowed to mix import and module.exporTS ,

The solution is to write to the way to modify ES6.

'Solution ">

Import {normaltime} from ‘./timeformat’ ;EXPORT Default NormalTime;

Operation again:

<img src="20210911/https://img.tumi.net/wp-content/uploads/2021/09/20210911035832-613c29687d8ab.jpg" alt="Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#

‘Solution “>
  Summary  
The above is all the contents of this article, I hope this article will bring a certain help to everyone’s learning or work. If you have any questions, you can leave a message, thank you for your support of Tumi Cloud.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment