{"action":"created","issue":{"url":"https://api.github.com/repos/google/closure-compiler/issues/880","labels_url":"https://api.github.com/repos/google/closure-compiler/issues/880/labels{/name}","comments_url":"https://api.github.com/repos/google/closure-compiler/issues/880/comments","events_url":"https://api.github.com/repos/google/closure-compiler/issues/880/events","html_url":"https://github.com/google/closure-compiler/issues/880","id":62721552,"number":880,"title":"Unable to mix ES6 module syntax and goog.provide","user":{"login":"DomBlack","id":236641,"avatar_url":"https://avatars.githubusercontent.com/u/236641?v=3","gravatar_id":"","url":"https://api.github.com/users/DomBlack","html_url":"https://github.com/DomBlack","followers_url":"https://api.github.com/users/DomBlack/followers","following_url":"https://api.github.com/users/DomBlack/following{/other_user}","gists_url":"https://api.github.com/users/DomBlack/gists{/gist_id}","starred_url":"https://api.github.com/users/DomBlack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DomBlack/subscriptions","organizations_url":"https://api.github.com/users/DomBlack/orgs","repos_url":"https://api.github.com/users/DomBlack/repos","events_url":"https://api.github.com/users/DomBlack/events{/privacy}","received_events_url":"https://api.github.com/users/DomBlack/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-18T15:28:05Z","updated_at":"2015-03-24T16:41:08Z","closed_at":null,"body":"If you have a file which is has a `goog.provide` at the top, and then attempts to import ES6 module code, the compiler will throw the following exception:\r\n\r\n```\r\n[error] something.js:3: variable sum is undeclared\r\n[error] import {sum, pi} from './math/lib';\r\n[error]         ^\r\n[error] something.js:3: variable pi is undeclared\r\n[error] import {sum, pi} from './math/lib';\r\n[error]              ^\r\n[error] two errors found\r\n```\r\n\r\nRemoving the `goog.provide` at the top of the file allows this file to compile without errors.\r\n\r\nIt would be useful to allow existing Closure code to import newer ES6 code.\r\n\r\n### Test Files:\r\n\r\n`something.js`;\r\n```js\r\ngoog.provide('something');\r\n\r\nimport {sum, pi} from './math/lib';\r\n\r\nconsole.log(sum(pi, pi));\r\n```\r\n\r\n`math/lib.js`;\r\n```js\r\nexport function sum(x, y) {\r\n    return x + y;\r\n}\r\n\r\nexport var pi = 3.14159;\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/google/closure-compiler/issues/comments/85592125","html_url":"https://github.com/google/closure-compiler/issues/880#issuecomment-85592125","issue_url":"https://api.github.com/repos/google/closure-compiler/issues/880","id":85592125,"user":{"login":"MatrixFrog","id":244381,"avatar_url":"https://avatars.githubusercontent.com/u/244381?v=3","gravatar_id":"","url":"https://api.github.com/users/MatrixFrog","html_url":"https://github.com/MatrixFrog","followers_url":"https://api.github.com/users/MatrixFrog/followers","following_url":"https://api.github.com/users/MatrixFrog/following{/other_user}","gists_url":"https://api.github.com/users/MatrixFrog/gists{/gist_id}","starred_url":"https://api.github.com/users/MatrixFrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatrixFrog/subscriptions","organizations_url":"https://api.github.com/users/MatrixFrog/orgs","repos_url":"https://api.github.com/users/MatrixFrog/repos","events_url":"https://api.github.com/users/MatrixFrog/events{/privacy}","received_events_url":"https://api.github.com/users/MatrixFrog/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T16:41:08Z","updated_at":"2015-03-24T16:41:08Z","body":"We don't allow goog.provide in modules, but we need to report an error saying that, rather than silently refusing to transpile the import/export statements. I've been meaning to fix this for a while so thank you for the reminder."}}