{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/7032","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/7032/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/7032/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/7032/events","html_url":"https://github.com/webpack/webpack/issues/7032","id":313932859,"node_id":"MDU6SXNzdWUzMTM5MzI4NTk=","number":7032,"title":"ProvidePlugin injection into .mjs files seems to be broken","user":{"login":"xandris","id":1970616,"node_id":"MDQ6VXNlcjE5NzA2MTY=","avatar_url":"https://avatars3.githubusercontent.com/u/1970616?v=4","gravatar_id":"","url":"https://api.github.com/users/xandris","html_url":"https://github.com/xandris","followers_url":"https://api.github.com/users/xandris/followers","following_url":"https://api.github.com/users/xandris/following{/other_user}","gists_url":"https://api.github.com/users/xandris/gists{/gist_id}","starred_url":"https://api.github.com/users/xandris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xandris/subscriptions","organizations_url":"https://api.github.com/users/xandris/orgs","repos_url":"https://api.github.com/users/xandris/repos","events_url":"https://api.github.com/users/xandris/events{/privacy}","received_events_url":"https://api.github.com/users/xandris/received_events","type":"User","site_admin":false},"labels":[{"id":841723323,"node_id":"MDU6TGFiZWw4NDE3MjMzMjM=","url":"https://api.github.com/repos/webpack/webpack/labels/Send%20a%20PR","name":"Send a PR","color":"0054d3","default":false},{"id":1089820,"node_id":"MDU6TGFiZWwxMDg5ODIw","url":"https://api.github.com/repos/webpack/webpack/labels/bug","name":"bug","color":"fbca04","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2018-04-13T00:42:25Z","updated_at":"2018-11-05T14:44:29Z","closed_at":"2018-11-05T07:59:30Z","author_association":"NONE","body":"<!-- Please don't delete this template or we'll close your issue -->\r\n<!-- Before creating an issue please make sure you are using the latest version of webpack. -->\r\n<!-- Also consider trying the webpack@beta version, maybe it's already fixed. -->\r\n\r\n**Do you want to request a *feature* or report a *bug*?**\r\n\r\nA bug, I think.\r\n\r\n<!-- Please ask questions on StackOverflow or the webpack Gitter (https://gitter.im/webpack/webpack). -->\r\n<!-- Issues which contain questions or support requests will be closed. -->\r\n\r\n**What is the current behavior?**\r\n\r\nAt runtime, a `.mjs` module with injections from `ProvidePlugin` will throw an error at runtime, indicating that `require` is not defined. The final module code produced by webpack looks like this:\r\n\r\n```javascript\r\n/*! no static exports found */\r\n/***/ (function(module, exports) {\r\n\r\n/* WEBPACK VAR INJECTION */(function(foo) {console.log(foo);\r\n/* WEBPACK VAR INJECTION */}.call(this, require(\"/Users/aparker/src/notes/webpack4upgrade/mjs-provide/foo.js\")))\r\n\r\n/***/ })\r\n\r\n/******/ });\r\n```\r\n\r\n(Note the call to `require`.)\r\n\r\n**If the current behavior is a bug, please provide the steps to reproduce.**\r\n\r\n[You can reproduce the behavior using this repository.](https://github.com/xandris/webpack-provideplugin-mjs-bug)\r\n\r\n<!-- A great way to do this is to provide your configuration via a GitHub gist. -->\r\n<!-- Best provide a minimal reproduceable repo -->\r\n<!-- If your issue is caused by a plugin or loader file the issue on the plugin/loader repo -->\r\n\r\n**What is the expected behavior?**\r\n\r\nThe module should look more like this:\r\n\r\n```javascript\r\n/*! no static exports found */\r\n/***/ (function(module, exports, __webpack_require__) {\r\n\r\n/* WEBPACK VAR INJECTION */(function(foo) {console.log(foo);\r\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./foo.js */ \"./foo.js\")))\r\n\r\n/***/ })\r\n\r\n/******/ });\r\n```\r\n\r\n**If this is a feature request, what is motivation or use case for changing the behavior?**\r\n\r\n**Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.**\r\n\r\n* `node -v`: `v9.11.1`\r\n* `webpack -v`: `4.5.0`\r\n* OS: Mac OS 10.13.4"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/435899916","html_url":"https://github.com/webpack/webpack/issues/7032#issuecomment-435899916","issue_url":"https://api.github.com/repos/webpack/webpack/issues/7032","id":435899916,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTg5OTkxNg==","user":{"login":"felixfbecker","id":10532611,"node_id":"MDQ6VXNlcjEwNTMyNjEx","avatar_url":"https://avatars0.githubusercontent.com/u/10532611?v=4","gravatar_id":"","url":"https://api.github.com/users/felixfbecker","html_url":"https://github.com/felixfbecker","followers_url":"https://api.github.com/users/felixfbecker/followers","following_url":"https://api.github.com/users/felixfbecker/following{/other_user}","gists_url":"https://api.github.com/users/felixfbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/felixfbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixfbecker/subscriptions","organizations_url":"https://api.github.com/users/felixfbecker/orgs","repos_url":"https://api.github.com/users/felixfbecker/repos","events_url":"https://api.github.com/users/felixfbecker/events{/privacy}","received_events_url":"https://api.github.com/users/felixfbecker/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T14:44:29Z","updated_at":"2018-11-05T14:44:29Z","author_association":"NONE","body":"Oh, I thought it was handled by ProvidePlugin. What is handling process.env.NODE_ENV?"}}
{"actor":{"display_login":"felixfbecker"}}