-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Version
3.0.5
Node and OS info
Node 10.12.0 / npm 6.4.1 / Debian 4.9.110-3 deb9u6
Steps to reproduce
Use a local file module in your package.
What is expected?
After the app is compiled successfully the browser should run the app without errors.
What is actually happening?
Chrome reports the following error when the app is initialized: Cannot assign to read only property 'exports' of object
This issue is fixed in my code however I wanted to document this so anyone else having the issue can find it.
I am using a local npm module with npm install ../path/to/module
.
After an upgrade the file based local module was not being transpiled correctly and was being sent to the browser with module.exports
intact. This caused the error in the browser: Cannot assign to read only property 'exports' of object
The fix was in this issue: webpack/webpack#4039 (comment)
I had to add sourceType: "unambiguous" to my babel.config.js
file.
Here is what my current babel.config.js
file looks like:
module.exports = {
presets: [
'@vue/app'
],
sourceType: 'unambiguous'
}
Hope this helps someone.
Update 2019-08-01
Checkout @sathish76 post below. It may be useful.