I’ve linked a package that is outside of the project by first running npm link
in the outside package, then npm link name-of-package
inside the project.
I am now getting this error:
Module build failed: ReferenceError: Unknown plugin "transform-es2015-arrow-functions" specified in "base" at 0, attempted to resolve relative to "/path/to/location/far/away/from/project/name-of-package"
Of course there’s no babel plugin there.
I’m avoiding the issue by sticking with
babel-core@6.1.21
, the latest version I’ve found that works withnpm link
. I’ve been able to upgrade other babel loaders, plugins, and presets without issue in the meantime. I also have the latestwebpack
andwebpack-dev-server
. Just going to wait for a solution.@basham Indeed,
babel-core@6.1.21
works! I’m using that for now, as being able tonpm link
makes dev life a lot easier.I’m also having the same issue using
babel-plugin-transform-async-to-generator
, I just downgraded frombabel-core@6.7.2
tobabel-core@6.1.21
and it works…Update: Found a workaround:
More info babel/babel-loader#166 (comment)
Any update on this?
Ah, the
require.resolve
trick makes it absolute, circumventing Webpack from looking for the plugin in the wrong place during build? Good workaround!Just a note that the
require.resolve
workaround only works up until Webpack version 1.12.15. Later versions useacorn
instead ofesprima
as the JS parser, and this seems to prevent parsing of the JSON in the query string somehow.If you’re here you’re probably looking for this solution (at least I was):
http://webpack.github.io/docs/troubleshooting.html#npm-linked-modules-doesn-t-find-their-dependencies
try to add
resolve: { symlinks: false },
to your webpack.config{symlinks: false}
fixes the error, however it disrupts webpack’s watch function (and therefore webpack-dev-server will not recompile when changing files in the “linked” dependency).Anybody found another solution?
Symlink false does not work with Gatsby which uses webpack 1.
+1
Any updates on this issue?😄
Just opened a PR on watchpack:
webpack/watchpack#72
My workaround (for webpack 3) which is compatible with webpack-dev-server:
First set the
resolve.modules
property:It is important that you supply the abs path to your
node_modules
The, for each babel preset and plugin, explicitly use
require.resolve
.Note this means you need to explicitly move any babel setup you have in a babelrc file into your webpack config (in my case it was moving the plugins defs)
This compiles and when I make a change in a
yarn link
‘d module, dev-server is picking up the changes