{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/2163","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/2163/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/2163/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/2163/events","html_url":"https://github.com/webpack/webpack/issues/2163","id":139941911,"number":2163,"title":"Change System.import() to import()","user":{"login":"guybedford","id":598730,"avatar_url":"https://avatars.githubusercontent.com/u/598730?v=3","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/webpack/webpack/labels/P0:%20Critical","name":"P0: Critical","color":"b60205"},{"url":"https://api.github.com/repos/webpack/webpack/labels/question","name":"question","color":"cc317c"},{"url":"https://api.github.com/repos/webpack/webpack/labels/webpack-2","name":"webpack-2","color":"c5def5"},{"url":"https://api.github.com/repos/webpack/webpack/labels/X3:%20discussion%20required","name":"X3: discussion required","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/webpack/webpack/milestones/9","html_url":"https://github.com/webpack/webpack/milestones/2.1-RC%20Blocking","labels_url":"https://api.github.com/repos/webpack/webpack/milestones/9/labels","id":1851865,"number":9,"title":"2.1-RC Blocking","description":"This milestone marks all bugs/features which are critical for Webpack 2's release. ","creator":{"login":"TheLarkInn","id":3408176,"avatar_url":"https://avatars.githubusercontent.com/u/3408176?v=3","gravatar_id":"","url":"https://api.github.com/users/TheLarkInn","html_url":"https://github.com/TheLarkInn","followers_url":"https://api.github.com/users/TheLarkInn/followers","following_url":"https://api.github.com/users/TheLarkInn/following{/other_user}","gists_url":"https://api.github.com/users/TheLarkInn/gists{/gist_id}","starred_url":"https://api.github.com/users/TheLarkInn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheLarkInn/subscriptions","organizations_url":"https://api.github.com/users/TheLarkInn/orgs","repos_url":"https://api.github.com/users/TheLarkInn/repos","events_url":"https://api.github.com/users/TheLarkInn/events{/privacy}","received_events_url":"https://api.github.com/users/TheLarkInn/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":2,"state":"open","created_at":"2016-06-28T02:10:15Z","updated_at":"2016-10-20T16:07:04Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-03-10T16:30:35Z","updated_at":"2016-10-20T16:07:04Z","closed_at":"2016-10-20T16:07:04Z","body":"I thought it would be worth mentioning this point for Webpack 2 consideration. The loader spec strictly specifies `System.loader.import` as the dynamic import entry point, instead of `System.import` as it used to be.\r\n\r\nThe other problem with using `System.import` is that strictly System.import shouldn't have any parent knowledge without a second argument. That is you'd really want `System.import('x', parentName)` to be the contextual require. Assuming `System.import` is already parent-scoped is going to not be true on the upgrade path at all. In SystemJS, we've defined a locally scoped `__moduleName` variable to allow for the above, but again it ends up being a custom solution.\r\n\r\nIn reality modules will have a contextual import function syntax available that will automatically scope the import to the current module parent so that this won't usually be necessary making for a nicer patter in ES modules. Perhaps it could be worth enquiring about that status of that syntax as well.\r\n\r\nThere might be the scope for a little more freedom to experiment here too. For example trying out one spec suggestion syntax like:\r\n\r\n```javascript\r\nexport function dynamicLoad() {\r\n  return import.default('x') // default export (import.namespace being the normal namespace import)\r\n}\r\n```\r\n\r\nwhich was discussed in https://github.com/whatwg/loader/issues/36#issuecomment-89049563. If the spec does implement it, the upgrade path works. If the spec doesn't implement it, then it's just a breaking change to adjust, so it's a no different scenario than using `System.import`.\r\n\r\nOne could even then experiment with another possible syntax like:\r\n\r\n```javascript\r\nexport function async dynamicLoad() {\r\n  return await import 'x';\r\n}\r\n```\r\n\r\nAnd treating that `import 'x'` as the dynamic import. Would `(import 'x').then(...)` make sense with that grammar?\r\n\r\nAt some level it does come down to betting on something somewhat custom, and aiming to minimise the risk and inform users about the situation.\r\n\r\nThe approach SystemJS is taking here is not trying to polyfill `System.loader` due to potential conflicts when native implementations eventually land. Instead the idea is to stick with the \"old\" API of `System.import` and then double this up with a smooth upgrade path to a best practice non-conflict `SystemJS.import`, only switching into `System.loader.import` when we're sure there won't be a native conflict.\r\n\r\nAt least that's the best approach I've been able to come up with so far. If you've already considered this not to worry, but just to check the `System.import` decision should at least be made knowingly to avoid an upgrade path issue like SystemJS now has (although it would be great for SystemJS to be able to share the same convention actually, so I probably should have just shut up here!)."},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/255151189","html_url":"https://github.com/webpack/webpack/issues/2163#issuecomment-255151189","issue_url":"https://api.github.com/repos/webpack/webpack/issues/2163","id":255151189,"user":{"login":"jhnns","id":781746,"avatar_url":"https://avatars.githubusercontent.com/u/781746?v=3","gravatar_id":"","url":"https://api.github.com/users/jhnns","html_url":"https://github.com/jhnns","followers_url":"https://api.github.com/users/jhnns/followers","following_url":"https://api.github.com/users/jhnns/following{/other_user}","gists_url":"https://api.github.com/users/jhnns/gists{/gist_id}","starred_url":"https://api.github.com/users/jhnns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhnns/subscriptions","organizations_url":"https://api.github.com/users/jhnns/orgs","repos_url":"https://api.github.com/users/jhnns/repos","events_url":"https://api.github.com/users/jhnns/events{/privacy}","received_events_url":"https://api.github.com/users/jhnns/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T16:07:04Z","updated_at":"2016-10-20T16:07:04Z","body":"Yep, closing this one in favor of #3098"}}
{"actor":{"display_login":"jhnns"}}