{"action":"created","issue":{"url":"https://api.github.com/repos/meteor/meteor/issues/6590","repository_url":"https://api.github.com/repos/meteor/meteor","labels_url":"https://api.github.com/repos/meteor/meteor/issues/6590/labels{/name}","comments_url":"https://api.github.com/repos/meteor/meteor/issues/6590/comments","events_url":"https://api.github.com/repos/meteor/meteor/issues/6590/events","html_url":"https://github.com/meteor/meteor/issues/6590","id":143419390,"number":6590,"title":"[1.3-rc.12] Sometimes modules don't get export from old-style packages","user":{"login":"clayne11","id":2831444,"avatar_url":"https://avatars.githubusercontent.com/u/2831444?v=3","gravatar_id":"","url":"https://api.github.com/users/clayne11","html_url":"https://github.com/clayne11","followers_url":"https://api.github.com/users/clayne11/followers","following_url":"https://api.github.com/users/clayne11/following{/other_user}","gists_url":"https://api.github.com/users/clayne11/gists{/gist_id}","starred_url":"https://api.github.com/users/clayne11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clayne11/subscriptions","organizations_url":"https://api.github.com/users/clayne11/orgs","repos_url":"https://api.github.com/users/clayne11/repos","events_url":"https://api.github.com/users/clayne11/events{/privacy}","received_events_url":"https://api.github.com/users/clayne11/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-25T04:09:34Z","updated_at":"2016-03-27T18:42:48Z","closed_at":null,"body":"When I use an old-style Meteor package (aka no `api.mainModule`), for some packages `import` doesn't see any exports.\r\n\r\nIn these instances, when I try to `import` something that is available globally from that package, it returns undefined.\r\n\r\nExample:\r\n\r\n```\r\n// package 1\r\nPackage.describe({\r\n  name: 'users',\r\n  version: '0.0.1',\r\n});\r\n\r\nPackage.onUse(function(api) {\r\n  api.use('ecmascript');\r\n  api.addFiles('users.js');\r\n  api.export('Users');\r\n});\r\n\r\n// users.js\r\nUsers = 'userString';\r\n\r\n// package 2\r\nPackage.describe({\r\n  name: 'test',\r\n  version: '0.0.1',\r\n});\r\n\r\nPackage.onUse(function(api) {\r\n  api.use('ecmascript');\r\n  api.use('users');\r\n  api.addFiles('test.js');\r\n});\r\n\r\n// test.js (attempt 1)\r\nimport {Users} from 'meteor/users';\r\n\r\nconsole.log(Users) // undefined\r\n\r\n// test.js (attempt 2 - sanity check)\r\nconsole.log(Users) // userString\r\n```\r\n\r\nThis only seems to happen some of the time and I'm not sure what the difference is when this happens vs when it works as expected."},"comment":{"url":"https://api.github.com/repos/meteor/meteor/issues/comments/202122542","html_url":"https://github.com/meteor/meteor/issues/6590#issuecomment-202122542","issue_url":"https://api.github.com/repos/meteor/meteor/issues/6590","id":202122542,"user":{"login":"Zaiban","id":9568791,"avatar_url":"https://avatars.githubusercontent.com/u/9568791?v=3","gravatar_id":"","url":"https://api.github.com/users/Zaiban","html_url":"https://github.com/Zaiban","followers_url":"https://api.github.com/users/Zaiban/followers","following_url":"https://api.github.com/users/Zaiban/following{/other_user}","gists_url":"https://api.github.com/users/Zaiban/gists{/gist_id}","starred_url":"https://api.github.com/users/Zaiban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zaiban/subscriptions","organizations_url":"https://api.github.com/users/Zaiban/orgs","repos_url":"https://api.github.com/users/Zaiban/repos","events_url":"https://api.github.com/users/Zaiban/events{/privacy}","received_events_url":"https://api.github.com/users/Zaiban/received_events","type":"User","site_admin":false},"created_at":"2016-03-27T18:42:48Z","updated_at":"2016-03-27T18:42:48Z","body":"I think the error I'm having is maybe related to this. Trying to use npm installed Mocha for unit testing, but running the tests gives errors like:\r\n`Error: Cannot find module 'meteor/meteor'\r\n    at Function.Module._resolveFilename (module.js:339:15)\r\n    at Function.Module._load (module.js:290:25)\r\n    at Module.require (module.js:367:17)\r\n    at require (internal/module.js:16:19)\r\n    at Object.<anonymous> (methods.js:1:1)\r\n    at Module._compile (module.js:413:34)\r\n    at loader (root/node_modules/babel-register/lib/node.js:126:5)\r\n    at Object.require.extensions.(anonymous function) [as .js] (root/node_modules/babel-register/lib/node.js:136:7)\r\n    at Module.load (module.js:357:32)\r\n    at Function.Module._load (module.js:314:12)\r\n    at Module.require (module.js:367:17)\r\n    at require (internal/module.js:16:19)\r\n    at Object.<anonymous> (methods.js:1:1)\r\n    at Module._compile (module.js:413:34)\r\n    at loader (root/node_modules/babel-register/lib/node.js:126:5)\r\n    at Object.require.extensions.(anonymous function) [as .js] (root/node_modules/babel-register/lib/node.js:136:7)\r\n    at Module.load (module.js:357:32)\r\n    at Function.Module._load (module.js:314:12)\r\n    at Module.require (module.js:367:17)\r\n    at require (internal/module.js:16:19)\r\n    at Object.<anonymous> (account.js:1:1)\r\n    at Module._compile (module.js:413:34)\r\n    at loader (root/node_modules/babel-register/lib/node.js:126:5)\r\n    at Object.require.extensions.(anonymous function) [as .js] (root/node_modules/babel-register/lib/node.js:136:7)\r\n    at Module.load (module.js:357:32)\r\n    at Function.Module._load (module.js:314:12)\r\n    at Module.require (module.js:367:17)\r\n    at require (internal/module.js:16:19)\r\n    at Object.<anonymous> (account.tests.js:3:1)\r\n    at Module._compile (module.js:413:34)\r\n    at loader (root/node_modules/babel-register/lib/node.js:126:5)\r\n    at Object.require.extensions.(anonymous function) [as .js] (root/node_modules/babel-register/lib/node.js:136:7)\r\n    at Module.load (module.js:357:32)\r\n    at Function.Module._load (module.js:314:12)\r\n    at Module.require (module.js:367:17)\r\n    at require (internal/module.js:16:19)\r\n    at root/node_modules/mocha/lib/mocha.js:219:27\r\n    at Array.forEach (native)\r\n    at Mocha.loadFiles (root/node_modules/mocha/lib/mocha.js:216:14)\r\n    at Mocha.run (root/node_modules/mocha/lib/mocha.js:468:10)\r\n    at loadAndRun (root/node_modules/mocha/bin/_mocha:359:22)\r\n    at Object.<anonymous> (root/node_modules/mocha/bin/_mocha:376:3)\r\n    at Module._compile (module.js:413:34)\r\n    at Object.Module._extensions..js (module.js:422:10)\r\n    at Module.load (module.js:357:32)\r\n    at Function.Module._load (module.js:314:12)\r\n    at Function.Module.runMain (module.js:447:10)\r\n    at startup (node.js:141:18)\r\n    at node.js:933:3\r\n`\r\n..when it is trying to import file that contains\r\n`import { Meteor } from 'meteor/meteor';`\r\n\r\nSame thing happens with all 'meteor/xxx' imports."}}