Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency on broccoli-persistent-filter causes problems #72

Closed
shaunc opened this issue Feb 3, 2016 · 2 comments
Closed

dependency on broccoli-persistent-filter causes problems #72

shaunc opened this issue Feb 3, 2016 · 2 comments

Comments

@shaunc
Copy link

shaunc commented Feb 3, 2016

I tried to fork and bump to babel-6

...
"babel-core": "^6.4.0",
...

I got the following problem:

  1) options "before all" hook:
     Cannot find module 'babel-runtime/' from '/Volumes/Macintosh_HD/Users/shauncutts/src/broccoli-babel-transpiler/node_modules/babel-code-frame/'
  Error: Cannot find module 'babel-runtime/' from 'node_modules/babel-code-frame/'
      at Function.module.exports (node_modules/resolve/lib/sync.js:33:11)
      at resolvePkg (node_modules/hash-for-dep/lib/resolve-pkg.js:20:18)
      at pkg (node_modules/hash-for-dep/lib/pkg.js:17:20)
      at again (node_modules/hash-for-dep/lib/deps-for.js:19:22)
      at node_modules/hash-for-dep/lib/deps-for.js:28:7
      at Array.forEach (native)
      at again (node_modules/hash-for-dep/lib/deps-for.js:27:55)
      at node_modules/hash-for-dep/lib/deps-for.js:28:7
      at Array.forEach (native)
      at again (node_modules/hash-for-dep/lib/deps-for.js:27:55)
      at node_modules/hash-for-dep/lib/deps-for.js:28:7
      at Array.forEach (native)
      at again (node_modules/hash-for-dep/lib/deps-for.js:27:55)
      at depsFor (node_modules/hash-for-dep/lib/deps-for.js:30:4)
      at statPathsFor (node_modules/hash-for-dep/lib/stat-paths-for.js:14:15)
      at hashForDep (node_modules/hash-for-dep/index.js:15:21)
      at Babel.Filter.cacheKey (node_modules/broccoli-persistent-filter/index.js:118:10)
      at Object.module.exports.cacheKey (node_modules/broccoli-persistent-filter/lib/strategies/persistent.js:22:16)
      at Object.module.exports.init (node_modules/broccoli-persistent-filter/lib/strategies/persistent.js:12:50)
      at Processor.init (node_modules/broccoli-persistent-filter/lib/processor.js:16:18)
      at Babel.Filter (node_modules/broccoli-persistent-filter/index.js:56:18)
      at new Babel (index.js:34:10)
      at Context.<anonymous> (test.js:38:13)

Drilling down, the problem is caused by babel-runtime not having a "main" key in its package.json. In "babel-code-frame/lib/index.js" we have:

var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];

... so we shouldn't have to have the "main" key. This seems like a weakness in hash-for-dep depending on node-resolve which requires a "main" file. This seems to have nothing to do with babel-6 per se. I'll look into reporting and patching downstream (it would seem that resolve takes a filter... hash-for-dep is just using the "main" file to hash it and not actually load it, so we could insert a fake main if package.json is read but is missing "main").

I thought I'd report here in case someone who actually understands the code has a better idea. This seems like something that would break quite often actually, so I'm wondering if I'm overlooking something.

@Turbo87
Copy link
Contributor

Turbo87 commented Apr 4, 2016

@shaunc seems to be fixed upstream now. can this be closed?

@shaunc
Copy link
Author

shaunc commented Apr 4, 2016

yes!

@shaunc shaunc closed this as completed Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants