{"action":"closed","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/1317","labels_url":"https://api.github.com/repos/webpack/webpack/issues/1317/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/1317/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/1317/events","html_url":"https://github.com/webpack/webpack/issues/1317","id":98372363,"number":1317,"title":"Different behaviour when requiring in webpack and directly in node","user":{"login":"schovi","id":11453,"avatar_url":"https://avatars.githubusercontent.com/u/11453?v=3","gravatar_id":"","url":"https://api.github.com/users/schovi","html_url":"https://github.com/schovi","followers_url":"https://api.github.com/users/schovi/followers","following_url":"https://api.github.com/users/schovi/following{/other_user}","gists_url":"https://api.github.com/users/schovi/gists{/gist_id}","starred_url":"https://api.github.com/users/schovi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schovi/subscriptions","organizations_url":"https://api.github.com/users/schovi/orgs","repos_url":"https://api.github.com/users/schovi/repos","events_url":"https://api.github.com/users/schovi/events{/privacy}","received_events_url":"https://api.github.com/users/schovi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-31T11:30:08Z","updated_at":"2015-08-05T10:37:45Z","closed_at":"2015-08-05T10:37:45Z","body":"I am having problem with momentjs library https://github.com/moment/moment/\r\nWhen installing npm package and require it `require('moment')` it requires all locales (lot of modules). But in node it requires only main library.\r\nIn webpack log it appears \r\n\r\n    [239] ./~/moment/moment.js 104 kB {0} {1} [built]\r\n    [240] ./~/moment/locale ^\\.\\/.*$ 2.06 kB {0} {1} [optional] [built]\r\n    [241] ./~/moment/locale/af.js 2.58 kB {0} {1} [optional] [built]\r\n    [242] ./~/moment/locale/ar.js 4.52 kB {0} {1} [optional] [built]\r\n    .... a lot more :)\r\n\r\nI tried to ask in momentjs issues: https://github.com/moment/moment/issues/2517\r\nI was thinking that [optional] modules will be skipped when build production javascript, but they are included. Any suggestions? "}}