Webpack-dev-server: Cannot assign to read only property 'exports' of object '#<Object>'

Created on 11 Jun 2019  路  10Comments  路  Source: webpack/webpack-dev-server

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

Most helpful comment

use [email protected] instead of 3.9.0 solved the problem

All 10 comments

Please submit the reproducible repo.

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

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

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.

Please create minimum reproducible test repo

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

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

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

use [email protected] instead of 3.9.0 solved the problem

use [email protected] instead of 3.9.0 solved the problem

It didn't help me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adiachenko picture adiachenko  路  3Comments

antoinerousseau picture antoinerousseau  路  3Comments

da2018 picture da2018  路  3Comments

wojtekmaj picture wojtekmaj  路  3Comments

subblue picture subblue  路  3Comments