{"action":"closed","issue":{"url":"https://api.github.com/repos/cspotcode/outdent/issues/9","repository_url":"https://api.github.com/repos/cspotcode/outdent","labels_url":"https://api.github.com/repos/cspotcode/outdent/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/cspotcode/outdent/issues/9/comments","events_url":"https://api.github.com/repos/cspotcode/outdent/issues/9/events","html_url":"https://github.com/cspotcode/outdent/issues/9","id":312591507,"node_id":"MDU6SXNzdWUzMTI1OTE1MDc=","number":9,"title":"outdent lib-module check for 'module' breaks code bundled with webpack","user":{"login":"avaragado","id":886041,"node_id":"MDQ6VXNlcjg4NjA0MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/886041?v=4","gravatar_id":"","url":"https://api.github.com/users/avaragado","html_url":"https://github.com/avaragado","followers_url":"https://api.github.com/users/avaragado/followers","following_url":"https://api.github.com/users/avaragado/following{/other_user}","gists_url":"https://api.github.com/users/avaragado/gists{/gist_id}","starred_url":"https://api.github.com/users/avaragado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avaragado/subscriptions","organizations_url":"https://api.github.com/users/avaragado/orgs","repos_url":"https://api.github.com/users/avaragado/repos","events_url":"https://api.github.com/users/avaragado/events{/privacy}","received_events_url":"https://api.github.com/users/avaragado/received_events","type":"User","site_admin":false},"labels":[{"id":1013744668,"node_id":"MDU6TGFiZWwxMDEzNzQ0NjY4","url":"https://api.github.com/repos/cspotcode/outdent/labels/accepting%20PR","name":"accepting PR","color":"1d76db","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-04-09T16:05:22Z","updated_at":"2018-09-04T01:01:22Z","closed_at":"2018-09-04T01:01:22Z","author_association":"NONE","body":"I'm not _entirely_ sure what's going on, but I'm using `outdent` in a project that's built using [next.js](https://github.com/zeit/next.js) (and hence webpack), and the built code has broken on upgrading from outdent 0.3.0 to 0.5.0.\r\n\r\nThe browser error includes these lines:\r\n\r\n```\r\nReferenceError: exports is not defined\r\n    at Object.<anonymous> (http://localhost:3000/_next/-/page/foo.js:7394:30)\r\n    at Object../node_modules/outdent/lib-module/index.js (http://localhost:3000/_next/-/page/foo.js:7401:30)\r\n    at __webpack_require__ (http://localhost:3000/_next/-/manifest.js:715:31)\r\n```\r\nThe JS built by webpack incorporates the `outdent/lib-module/index.js` file like this (I've omitted the irrelevant bits of the `foo.js` file):\r\n\r\n```js\r\n/***/ \"./node_modules/outdent/lib-module/index.js\":\r\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\r\n\r\n\"use strict\";\r\n/* WEBPACK VAR INJECTION */(function(module) {/* unused harmony export outdent */\r\n// In the absence of a WeakSet or WeakMap implementation, don't break, but don't cache either.\r\n\r\n// ...lots omitted here...\r\n\r\n// Named exports.  Simple and preferred.\r\n/* harmony default export */ __webpack_exports__[\"a\"] = (outdent);\r\n\r\nif (true) {\r\n    module.exports = exports = outdent;\r\n    // TODO is this necessary?\r\n    Object.defineProperty(outdent, '__esModule', { value: true });\r\n    outdent.default = outdent;\r\n    outdent.outdent = outdent;\r\n}\r\n//# sourceMappingURL=index.js.map\r\n/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(\"./node_modules/webpack/buildin/harmony-module.js\")(module)))\r\n\r\n```\r\n\r\nYou'll see that the original code's check `if (typeof module !== 'undefined')` has been optimised to `if (true)`, presumably as `module` exists -- but there's no `exports` variable, so the code explodes.\r\n\r\nIs there a better check you could do on that line to achieve the desired effect?"}}
{"actor":{"display_login":"cspotcode"}}