Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot assign to read only property 'exports' of object '#<Object>' #2010

Closed
VictorWu90 opened this issue Jun 11, 2019 · 10 comments
Closed

Cannot assign to read only property 'exports' of object '#<Object>' #2010

VictorWu90 opened this issue Jun 11, 2019 · 10 comments

Comments

@VictorWu90
Copy link

  • Operating System:macOS Mojave 10.14.4
  • Node Version:v9.11.1
  • NPM Version:6.9.0
  • webpack Version:4.33.0
  • webpack-dev-server Version:3.7.1

dev doesn't work.The info is:
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#'
at Module. (SockJSClient.js:28)
at Module../node_modules/webpack-dev-server/client/clients/SockJSClient.js (SockJSClient.js:69)
at webpack_require (bootstrap:783)
at fn (bootstrap:143)
at Object../node_modules/webpack-dev-server/client/socket.js (socket.js:45)
at webpack_require (bootstrap:783)
at fn (bootstrap:143)
at Module. (index.js:8)
at Module../node_modules/webpack-dev-server/client/index.js?http://localhost:8082 (index.js:176)
at webpack_require (bootstrap:783)

It goes well when I change the webpack-dev-server version to 3.5.1

@hiroppy
Copy link
Member

hiroppy commented Jun 11, 2019

Please submit the reproducible repo.

@alexander-akait
Copy link
Member

I think problem on minimizer side, you should disable minimizer when you in development mode, also looks you use old uglify-js version and plugin

@VictorWu90
Copy link
Author

VictorWu90 commented Jun 17, 2019

I disable minimizer when in development mode, and so that It's not about the uglify-js.

I think problem on minimizer side, you should disable minimizer when you in development mode, also looks you use old uglify-js version and plugin

@VictorWu90
Copy link
Author

module.exports =
/#PURE/
function (_BaseClient) {
_inherits(SockJSClient, _BaseClient);

function SockJSClient(url) {
var _this;

_classCallCheck(this, SockJSClient);

_this = _possibleConstructorReturn(this, _getPrototypeOf(SockJSClient).call(this));
_this.sock = new SockJS(url);
return _this;

}

_createClass(SockJSClient, [{
key: "onOpen",
value: function onOpen(f) {
this.sock.onopen = f;
}
}, {
key: "onClose",
value: function onClose(f) {
this.sock.onclose = f;
} // call f with the message string as the first argument

}, {
key: "onMessage",
value: function onMessage(f) {
this.sock.onmessage = function (e) {
f(e.data);
};
}
}], [{
key: "getClientPath",
value: function getClientPath(options) {
return require.resolve('./SockJSClient');
}
}]);

return SockJSClient;
}(BaseClient);

It's the info in console.

@alexander-akait
Copy link
Member

Please create minimum reproducible test repo

@alexander-akait
Copy link
Member

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

@ghost
Copy link

ghost commented Aug 26, 2019

S:\express my project\node_modules\mongoose\lib\connection.js:62
this.plugins = [];
^

TypeError: Cannot assign to read only property 'plugins' of object '#'
at Mongoose.Connection (S:\express my project\node_modules\mongoose\lib\connection.js:62:16)
at Mongoose.NativeConnection [as Connection] (S:\express my project\node_modules\mongoose\lib\drivers\node-mongodb-native\connection.js:18:22)
at Object. (S:\express my project\vchamp.js:14:10)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
[nodemon] app crashed - waiting for file changes before starting...

this problem solution

@yikuo123
Copy link

yikuo123 commented Sep 3, 2019

I encountered the same problem. I found that if compiling webpack-dev-server with babel7, this would occur.

@GoldSubmarine
Copy link

use webpack-dev-server@3.5.1 instead of 3.9.0 solved the problem

@StepanovMax
Copy link

use webpack-dev-server@3.5.1 instead of 3.9.0 solved the problem

It didn't help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants