{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/7132","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/7132/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/7132/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/7132/events","html_url":"https://github.com/webpack/webpack/pull/7132","id":318246261,"number":7132,"title":"Added `output.moduleExportsConfigurable` for mocking exports in tests","user":{"login":"gmathieu","id":7855,"avatar_url":"https://avatars0.githubusercontent.com/u/7855?v=4","gravatar_id":"","url":"https://api.github.com/users/gmathieu","html_url":"https://github.com/gmathieu","followers_url":"https://api.github.com/users/gmathieu/followers","following_url":"https://api.github.com/users/gmathieu/following{/other_user}","gists_url":"https://api.github.com/users/gmathieu/gists{/gist_id}","starred_url":"https://api.github.com/users/gmathieu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmathieu/subscriptions","organizations_url":"https://api.github.com/users/gmathieu/orgs","repos_url":"https://api.github.com/users/gmathieu/repos","events_url":"https://api.github.com/users/gmathieu/events{/privacy}","received_events_url":"https://api.github.com/users/gmathieu/received_events","type":"User","site_admin":false},"labels":[{"id":572712741,"url":"https://api.github.com/repos/webpack/webpack/labels/PR:%20CI-ok","name":"PR: CI-ok","color":"0e8a16","default":false},{"id":572817354,"url":"https://api.github.com/repos/webpack/webpack/labels/PR:%20unreviewed","name":"PR: unreviewed","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-04-27T01:14:00Z","updated_at":"2018-05-11T15:51:24Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/webpack/webpack/pulls/7132","html_url":"https://github.com/webpack/webpack/pull/7132","diff_url":"https://github.com/webpack/webpack/pull/7132.diff","patch_url":"https://github.com/webpack/webpack/pull/7132.patch"},"body":"**What kind of change does this PR introduce?**\r\n\r\nAdded `output.moduleExportsConfigurable` that defines export properties as configurable so es6 exports can be mocked.\r\nMocking exports only works when `mode != 'production'`.\r\n\r\n**Did you add tests for your changes?**\r\n\r\nYes\r\n\r\n**If relevant, link to documentation update:**\r\n\r\nIf this PR is accepted, I'll happily create a PR in the docs repo.\r\n\r\n**Summary**\r\n\r\n[Continuing off this issue](https://github.com/webpack/webpack/issues/6979)...\r\n\r\nBefore Webpack 4 certain ES Module exports were assigned to the export object by mutating it.\r\nMost stubbing libraries like SinonJS rely on the fact that objects are mutable to apply stubs, spies, etc...\r\nI understand mutating exports can have undesirable consequences and Webpack 4 did a great job fixing this.\r\nThis PR keeps the default behavior intact and adds a configuration to enable simple mocks bypassing complex dependency injection libraries.\r\n\r\n**Does this PR introduce a breaking change?**\r\n\r\nNo\r\n\r\n**Other information**\r\n\r\nI'm not married to the name of \"moduleExportsConfigurable\" and happy welcome feedback on only allowing this when mode === development.\r\n\r\nStubbing getter attributes with Sinon.JS: http://sinonjs.org/releases/v4.5.0/stubs/#stubgetgetterfn\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/388404649","html_url":"https://github.com/webpack/webpack/pull/7132#issuecomment-388404649","issue_url":"https://api.github.com/repos/webpack/webpack/issues/7132","id":388404649,"user":{"login":"Janpot","id":2109932,"avatar_url":"https://avatars2.githubusercontent.com/u/2109932?v=4","gravatar_id":"","url":"https://api.github.com/users/Janpot","html_url":"https://github.com/Janpot","followers_url":"https://api.github.com/users/Janpot/followers","following_url":"https://api.github.com/users/Janpot/following{/other_user}","gists_url":"https://api.github.com/users/Janpot/gists{/gist_id}","starred_url":"https://api.github.com/users/Janpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Janpot/subscriptions","organizations_url":"https://api.github.com/users/Janpot/orgs","repos_url":"https://api.github.com/users/Janpot/repos","events_url":"https://api.github.com/users/Janpot/events{/privacy}","received_events_url":"https://api.github.com/users/Janpot/received_events","type":"User","site_admin":false},"created_at":"2018-05-11T15:51:24Z","updated_at":"2018-05-11T15:51:24Z","author_association":"MEMBER","body":"@bregenspan Just for the record, I maintain code affected by this issue as well. 🙂 "}}
{"actor":{"display_login":"Janpot"}}