{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/1","repository_url":"https://api.github.com/repos/nodejs/ecmascript-modules","labels_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/1/comments","events_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/1/events","html_url":"https://github.com/nodejs/ecmascript-modules/pull/1","id":353150831,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwMjgzNTYz","number":1,"title":"Import meta require","user":{"login":"MylesBorins","id":498775,"node_id":"MDQ6VXNlcjQ5ODc3NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/498775?v=4","gravatar_id":"","url":"https://api.github.com/users/MylesBorins","html_url":"https://github.com/MylesBorins","followers_url":"https://api.github.com/users/MylesBorins/followers","following_url":"https://api.github.com/users/MylesBorins/following{/other_user}","gists_url":"https://api.github.com/users/MylesBorins/gists{/gist_id}","starred_url":"https://api.github.com/users/MylesBorins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MylesBorins/subscriptions","organizations_url":"https://api.github.com/users/MylesBorins/orgs","repos_url":"https://api.github.com/users/MylesBorins/repos","events_url":"https://api.github.com/users/MylesBorins/events{/privacy}","received_events_url":"https://api.github.com/users/MylesBorins/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2018-08-22T22:34:21Z","updated_at":"2018-08-25T14:38:38Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/nodejs/ecmascript-modules/pulls/1","html_url":"https://github.com/nodejs/ecmascript-modules/pull/1","diff_url":"https://github.com/nodejs/ecmascript-modules/pull/1.diff","patch_url":"https://github.com/nodejs/ecmascript-modules/pull/1.patch"},"body":"From https://github.com/nodejs/node/pull/21317\r\n\r\n> Hey All,\r\n> \r\n> This builds on top of @targos's earlier implementation of `import.meta.require`. It has been refactored to work with our current layout for the module system. I've also added some basic tests, let me know if you think we need something more robust.\r\n> \r\n> @nodejs/modules I am not planning to land this without consensus from the group, but I think that this is a necessary base feature no matter what implementation we move forward with. I'll open a corresponding issue to discuss."},"comment":{"url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/comments/415973617","html_url":"https://github.com/nodejs/ecmascript-modules/pull/1#issuecomment-415973617","issue_url":"https://api.github.com/repos/nodejs/ecmascript-modules/issues/1","id":415973617,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTk3MzYxNw==","user":{"login":"bmeck","id":234659,"node_id":"MDQ6VXNlcjIzNDY1OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/234659?v=4","gravatar_id":"","url":"https://api.github.com/users/bmeck","html_url":"https://github.com/bmeck","followers_url":"https://api.github.com/users/bmeck/followers","following_url":"https://api.github.com/users/bmeck/following{/other_user}","gists_url":"https://api.github.com/users/bmeck/gists{/gist_id}","starred_url":"https://api.github.com/users/bmeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmeck/subscriptions","organizations_url":"https://api.github.com/users/bmeck/orgs","repos_url":"https://api.github.com/users/bmeck/repos","events_url":"https://api.github.com/users/bmeck/events{/privacy}","received_events_url":"https://api.github.com/users/bmeck/received_events","type":"User","site_admin":false},"created_at":"2018-08-25T14:38:38Z","updated_at":"2018-08-25T14:38:38Z","author_association":"MEMBER","body":"@WebReflection \r\n\r\n> Currently every project behind bundlers use either import and let the bundler solve the kind or just require which works out of the box.\r\n\r\nI'm not sure this really relates as bundlers implement their own form of `require` instead of using the Node one, and they also convert `import` to their own bundling format. The discussion here is mostly tailored around how to let users write as much code in ESM that is unchanged when passed to both node and potentially other environments.\r\n\r\n> Everything a bundler or synchronous loader, needs to do with import.meta.require is to drop import.meta. and keep require, if it's targeting CJS and transforms all pseudo ESM into CJS, or do nothing if the env is ESM and the native import.meta.require is used.\r\n\r\nThis tailors the experience to the bundler, I am more concerned with allowing the user to be encouraged down a path of maximal compatibility than pleasing tool makers.\r\n\r\n> This is a migration path that requires zero effort for users and tiny effort for bundlers.\r\n\r\nBundlers could easy boilerplate out the bundle example I have above. This doesn't seem to discount that nor does it address that users must also migrate all code to `import.meta.require` instead of `require`, so there is migration effort on both. I have little concern for overall implementation effort on bundlers for `createRequireFunction` as there are plenty of ways to do bailouts and tree shaking without relying on `import`/`export` and using variable tracking of different kinds.\r\n\r\n> Anything else that needs user-land solution won't be as simple, straight forward, and effective as import.meta.require and bundlers won't be able anymore to understand where and how files should be loaded because every logic to require CJS will be potentially different and harder to analyze/understand.\r\n\r\nI don't understand how this relates when bundlers could just alter output formats. This also seems to be a claim about CJS being hard to analyze that is applied to both `import.meta.require` and `createRequireFunction`. If this could be expanded upon and explained in a more concrete way, that would potentially show why this point is relevant.\r\n\r\n> Goodbye tree shaking, code splitting, and ease of parsing if we push out a user-land based, potentially always different per project/company, module loader.\r\n\r\nThis doesn't make sense.\r\n\r\n> This is my logical evidence.\r\n\r\nI'd once again encourage you to not claim your own point as a conclusion at the end of your statements. It often creates both friction and confusion. In this case, mostly confusion on my part."}}
{"actor":{"display_login":"bmeck"}}