babel: [BUG] "Unknown plugin" in linked or aliased modules while using babel-loader in Webpack. (T6942)
Issue originally made by @trusktr
Description
I’ve got an error that I thought I’d mention here. I’m not sure if it’s a Babel problem or Webpack problem. I’m getting an error like this:
Module build failed: ReferenceError: Unknown plugin "transform-es2015-arrow-functions" specified in "base" at 0, attempted to resolve relative to "/home/trusktr/src/infamous+infamous"
where /home/trusktr/src/infamous+infamous
is an NPM package that I’ve npm link
ed into my project. I also get the same error if I use Webpack’s alias
option instead of npm link
ing.
More details and a stack trace that goes through babel code here: https://github.com/webpack/webpack/issues/1870
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 23 (4 by maintainers)
The approach @hzoo mentioned would be changing
to
which should pass in the plugin directly and avoid the path looking.
We’re also planning to revisit this behavior in Babel 7.x to hopefully make stuff like this less likely to fail.
Also getting this issue
Almost certainly because when linking it creates a symbolic link, and babel is getting confused (trying to get the plugins relative to the target, rather than the link)
May be way off base, but possibly related to https://github.com/babel/babel/commit/8fd543edae545d6e528e40668d5cade6e3c5fb49#diff-75a0292ed78043766c2d5564edd84ad2R55
require.resolve should cover npm link, can make another issue if there’s still issues.
Example https://github.com/facebookincubator/create-react-app/blob/7408e36478ea7aa271c9e16f51444547a063b400/packages/babel-preset-react-app/index.js#L15