Answer the question
In order to leave comments, you need to log in
Why is webpack with gulp not including node_modules?
I'm using gulp and webpack-stream for js, regular imports work on files, but node_modules doesn't. For some reason webpack is trying to look for node_modules in where the scripts
are Module not found: Error: Can't resolve 'swiper' in 'C:\projects\layout-in-HB\scripts'
Config:
gulp.task('js', function() {
return gulp
.src('scripts/app.js')
.pipe(plumber())
.pipe(webpackStream({
output: {
filename:'app.js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
resolve:{
modules: ['node_modules'],
extensions: [".js"]
},
mode: 'development'
}))
.pipe(gulp.dest('dist/scripts'));
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question