Transform in package.json on symlinked modules not working in npm3
See original GitHub issueEnvironment: node@5.70 npm@3.75 browserify@13.0.0 babelify@7.2.0
Trying to build an app that worked with npm@2
and babelify@6
but having problems upgrading to npm@3
and babelify@7
. Allow me to try and explain the problem.
- In
app/node_modules
I have modules installed vianpm install
and local modules symlinked vianpm link
. - The local modules have browserify transforms specified in their
package.json
e.g -
...
},
"devDependencies": {
"babel-preset-es2015": "^6.5.0",
"babelify": "^7.2.0"
},
"browserify": {
"transform": [
[
"babelify",
{
"presets": [
"es2015"
]
}
]
]
}
...
Attempting to build I get error:
"Browserify Error: Couldn't find preset "es2015" relative to directory"
npm 3 has flattened out the dependency tree, so the babel-preset-es2015
the symlinked module needs are in the node_modules
of app
. According to the explanation by @substack here and this example here browserify should walk up the tree from the symlinked module to app
and check in the node_modules
there, but it doesn’t seem to be doing this.
My directory layout looks like this:
~/projects
|-- app
|-- entry.js (this file can see babel-preset just fine)
|-- node_modules
|-- babel-preset-es2015
|-- my-module (symlink pointing at ~/projects/modules-shared/my-module)
|-- index.js (we want babelify to transform this file)
|-- modules-shared
|-- my-module
If I install babel-preset-es2015
in the modules-shared
folder, browserify finds the preset.
I get the impression from looking through other issues that this sort of problem has come up before and has long been fixed, so I wonder why I have the problem now.
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
.mjs
- i’m not aware of anybody using.esm
.Yes thanks, I meant that @ljharb