node -v): 7.7.1npm -v): 4.1.2Requiring file from vendor directory gives error:
ERROR Failed to compile with 1 errors 00:54:20
error in /Users/misterio/Dropbox/~Projects/dashkit/resources/assets/js/dashkit.js
Module build failed: Error: Couldn't find preset "es2015" relative to directory "/Users/misterio/Dropbox/~Projects/dashkit/resources/assets/js"
at /Users/misterio/PhpstormProjects/dashkit/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
app.js:
require('../../../vendor/dashkit/dashkit/resources/assets/js/dashkit');
app.scss:
@import "../../../vendor/dashkit/dashkit/resources/assets/sass/dashkit";
Compiling works if I run yarn or npm install in vendor/dashkit/dashkit directory. Otherwise, it fails.
Also, have to mention that directory vendor/dashkit is symlinked.
It could be related to the fact that the directory is symlinked. Not sure.
Are you using a custom .babelrc file in your project root?
@JeffreyWay No, I am not using custom .babelrc. Seems that webpack works strange with symlinks.
Yeah, this is a Webpack issue based on how it resolves symlinked paths. It's unrelated to Mix, so we can't do anything about that.
I ran into a similar issue with symlinks using Laravel Mix on an Elixir Phoenix project (I know, not a typical use case). For context, Phoenix framework includes channel support. The recommended package.json dependencies looks like the following for their wheels-included channel support:
{
"devDependencies": {
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"..."
}
}
Previously, this setup worked fine, but on update to npm version 5.*, npm began symlinking files into node_modules and things began to bomb out when running npm run watch commands. I was able to get back to properly compiling assets by updating the following in webpack.mix.js:
mix.webpackConfig({
resolve: {
symlinks: false,
}
});
Most helpful comment
I ran into a similar issue with symlinks using Laravel Mix on an Elixir Phoenix project (I know, not a typical use case). For context, Phoenix framework includes channel support. The recommended
package.jsondependencies looks like the following for their wheels-included channel support:Previously, this setup worked fine, but on update to npm version 5.*, npm began symlinking files into
node_modulesand things began to bomb out when runningnpm run watchcommands. I was able to get back to properly compiling assets by updating the following inwebpack.mix.js: