{"action":"opened","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/2735","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/2735/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/2735/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/2735/events","html_url":"https://github.com/webpack/webpack/issues/2735","id":163552793,"number":2735,"title":"Live binding not ready? Solved with nested imports?","user":{"login":"trusktr","id":297678,"avatar_url":"https://avatars.githubusercontent.com/u/297678?v=3","gravatar_id":"","url":"https://api.github.com/users/trusktr","html_url":"https://github.com/trusktr","followers_url":"https://api.github.com/users/trusktr/followers","following_url":"https://api.github.com/users/trusktr/following{/other_user}","gists_url":"https://api.github.com/users/trusktr/gists{/gist_id}","starred_url":"https://api.github.com/users/trusktr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trusktr/subscriptions","organizations_url":"https://api.github.com/users/trusktr/orgs","repos_url":"https://api.github.com/users/trusktr/repos","events_url":"https://api.github.com/users/trusktr/events{/privacy}","received_events_url":"https://api.github.com/users/trusktr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-03T08:28:16Z","updated_at":"2016-07-03T08:28:16Z","closed_at":null,"body":"For example, I have two modules, A and B that are a circular dependency:\r\n\r\n```js\r\n// A.js\r\nimport someFunction from './other-module'\r\n\r\nlet A = null\r\nexport default A\r\n\r\nif (!A) defineClassA() // this doesn't fire, the error happens first\r\n\r\nexport\r\nfunction defineClassA() {\r\n  someFunction() // Error happens here, triggered from B.js\r\n\r\n  A = class { /* ... */ }\r\n}\r\n```\r\n\r\n```js\r\n// B.js\r\nimport A, {defineClassA} from `./A`\r\n\r\nif (!A) defineClassA() // this fires and triggers the error.\r\n\r\nexport default\r\nclass B extends A { /* ... */ }\r\n```\r\n\r\nThe error is\r\n\r\n```\r\nUncaught TypeError: Cannot read property 'default' of undefined\r\n```\r\n\r\nwhere the compiled code looks like\r\n\r\n```js\r\n(0, _someFunction2.default)();\r\n```\r\n\r\nThere seems to be a module load-order issue at play. Any recommendations on how to handle this? I could just add the `import someFunction` statement into B.js, which solves the problem, but seems awkward since I'm not using `someFunction` inside of B.js.\r\n\r\nThis also leads me to think that nested imports would force a solution to the problem here. See [reify](https://github.com/benjamn/reify) and [The case for nested `import` declarations](https://github.com/benjamn/reify/blob/master/WHY_NEST_IMPORTS.md). cc @benjamn"}}
{"actor":{"display_login":"trusktr"}}