{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/5639","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/5639/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/5639/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/5639/events","html_url":"https://github.com/webpack/webpack/issues/5639","id":255838813,"number":5639,"title":"dynamic require all bundled in","user":{"login":"willin","id":1890238,"avatar_url":"https://avatars2.githubusercontent.com/u/1890238?v=4","gravatar_id":"","url":"https://api.github.com/users/willin","html_url":"https://github.com/willin","followers_url":"https://api.github.com/users/willin/followers","following_url":"https://api.github.com/users/willin/following{/other_user}","gists_url":"https://api.github.com/users/willin/gists{/gist_id}","starred_url":"https://api.github.com/users/willin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willin/subscriptions","organizations_url":"https://api.github.com/users/willin/orgs","repos_url":"https://api.github.com/users/willin/repos","events_url":"https://api.github.com/users/willin/events{/privacy}","received_events_url":"https://api.github.com/users/willin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-09-07T07:19:55Z","updated_at":"2017-09-08T06:12:05Z","closed_at":null,"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\nquestion\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\nhttps://github.com/AirDwing/webpack-server-bundle\r\n\r\n```js\r\nconst ENV = process.env.API_ENV || 'development';\r\n// eslint-disable-next-line import/no-dynamic-require\r\nconst options = require(`./_${ENV}`);\r\n\r\nmodule.exports = options;\r\n```\r\n\r\nif there are several config files like `_development.js` , `_.production.js`\r\n\r\nwhen i build, i specify `ENV` to one, but other files are also bundled in. like:\r\n```js\r\n(function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='/',b(b.s=3)})([function(a,b,c){const d=c(4)(`./_${'development'}`);a.exports=d},function(a,b){b.enabledModules=['demo'],b.mysq={connectionLimit:10,host:'127.0.0.1',user:'root',password:'root'},b.redis={host:'127.0.0.1',port:6379,db:1,ttl:3600},b.server={port:3300,hostname:'127.0.0.1'}},function(a,b){b.enabledModules=['demo2'],b.mysq={connectionLimit:10,host:'127.0.0.1',user:'root',password:'root'},b.redis={host:'127.0.0.1',port:6379,db:1,ttl:3600},b.server={port:3300,hostname:'127.0.0.1'}},function(a,b,c){const{server:d}=c(0),e=c(5);e.listen(d),console.log(new Date)},function(a,b,c){function d(a){return c(e(a))}function e(a){var b=f[a];if(!(b+1))throw new Error('Cannot find module \\''+a+'\\'.');return b}var f={\"./_development\":1,\"./_development.js\":1,\"./_production\":2,\"./_production.js\":2};d.keys=function(){return Object.keys(f)},d.resolve=e,a.exports=d,d.id=4},function(a,b,c){const d=c(6),e=c(7),{enabledModules:f}=c(0),g=new d;g.use(e()),f.forEach((a)=>{const b=c(8)(`./${a}/route`);g.use(b.middleware())}),a.exports=g},function(a){a.exports=require('koa')},function(a){a.exports=require('koa-api-logger')},function(a,b,c){function d(a){return c(e(a))}function e(a){var b=f[a];if(!(b+1))throw new Error('Cannot find module \\''+a+'\\'.');return b}var f={\"./demo/route\":9};d.keys=function(){return Object.keys(f)},d.resolve=e,a.exports=d,d.id=8},function(a,b,c){const d=c(10),e=c(11),f=d();f.prefix('/demo'),f.route(e),a.exports=f},function(a){a.exports=require('koa-joi-router')},function(a,b,c){const d=c(12),e=[{method:'get',path:'/test',validate:{query:{name:d.string().max(100).description('new user name')}},handler:async(a)=>{a.status=200,a.body={status:1,msg:'hello world'}},swagger:{tags:['demo'],responses:{200:{description:'\\u67E5\\u8BE2\\u57DF\\u540D',schema:d.object({status:d.number().integer().default(1),server:d.string().default('js.cool')}).label('serverSuccess')}}}}];a.exports=e},function(a){a.exports=require('joi')}]);\r\n//# sourceMappingURL=app.js.map\r\n```\r\n\r\n```js\r\n{\"./_development\":1,\"./_development.js\":1,\"./_production\":2,\"./_production.js\":2};\r\n```\r\n\r\n**What is the expected behavior?**\r\n\r\nonly one config file (dynamic required) should be bundled in\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\nwebpack latest version\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/328008618","html_url":"https://github.com/webpack/webpack/issues/5639#issuecomment-328008618","issue_url":"https://api.github.com/repos/webpack/webpack/issues/5639","id":328008618,"user":{"login":"willin","id":1890238,"avatar_url":"https://avatars2.githubusercontent.com/u/1890238?v=4","gravatar_id":"","url":"https://api.github.com/users/willin","html_url":"https://github.com/willin","followers_url":"https://api.github.com/users/willin/followers","following_url":"https://api.github.com/users/willin/following{/other_user}","gists_url":"https://api.github.com/users/willin/gists{/gist_id}","starred_url":"https://api.github.com/users/willin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willin/subscriptions","organizations_url":"https://api.github.com/users/willin/orgs","repos_url":"https://api.github.com/users/willin/repos","events_url":"https://api.github.com/users/willin/events{/privacy}","received_events_url":"https://api.github.com/users/willin/received_events","type":"User","site_admin":false},"created_at":"2017-09-08T06:12:05Z","updated_at":"2017-09-08T06:12:05Z","author_association":"NONE","body":"```\r\nPublicPath: /\r\n     Asset     Size  Chunks             Chunk Names\r\n    app.js   2.7 kB       0  [emitted]  app\r\napp.js.map  8.26 kB       0  [emitted]  app\r\nEntrypoint app = app.js app.js.map\r\nchunk    {0} app.js, app.js.map (app) 3.36 kB [entry] [rendered]\r\n    > app [3] ./src/index.js\r\n    [0] ./config/index.js 152 bytes {0} [depth 1] [built]\r\n        cjs require ../config [3] ./src/index.js 3:14-34\r\n        cjs require ../config [5] ./src/server.js 15:14-34\r\n    [3] ./src/index.js 300 bytes {0} [depth 0] [built]\r\n    [4] ./config/_development.js 274 bytes {0} [depth 2] [built]\r\n        cjs require ./_development [0] ./config/index.js 2:16-69\r\n    [5] ./src/server.js 674 bytes {0} [depth 1] [built]\r\n        cjs require ./server [3] ./src/index.js 5:14-33\r\n    [8] ./src ^\\.\\/.*\\/route$ 194 bytes {0} [depth 2] [built]\r\n        cjs require context . [5] ./src/server.js 23:78-103\r\n    [9] ./src/demo/route/index.js 184 bytes {0} [depth 3] [optional] [built]\r\n        context element ./demo/route [8] ./src ^\\.\\/.*\\/route$ ./demo/route\r\n   [10] ./src/demo/route/test.js 616 bytes {0} [depth 4] [built]\r\n        cjs require ./test [9] ./src/demo/route/index.js 5:13-30\r\n   [11] ./src/test/route/index.js 184 bytes {0} [depth 3] [optional] [built]\r\n        context element ./test/route [8] ./src ^\\.\\/.*\\/route$ ./test/route\r\n   [12] ./src/test/route/test.js 616 bytes {0} [depth 4] [built]\r\n        cjs require ./test [11] ./src/test/route/index.js 5:13-30\r\n     + 4 hidden modules\r\n```\r\n\r\noptional regexp match"}}
{"actor":{"display_login":"willin"}}