Answer the question
In order to leave comments, you need to log in
Webpack how to specify module paths?
Good afternoon, help, webpack stopped finding paths to the node_modules folder
Here is my assembly https://github.com/reskwer/blanknpm run gulp
- The project is launched like this (I do not have Gulp4 globally)
gulp is in dev/gulp/
Webpack task
import gulp from 'gulp';
import webpack from 'webpack-stream';
import plumber from 'gulp-plumber';
import errorHandler from './errorHandler';
import {projectPath, distPath} from './path';
gulp.task('js', function() {
let webpackOptions = {
output: {
filename: distPath('js/script.js'),
library: 'app'
},
devtool: 'cheap-inline-module-source-map',
module: {
loaders: [{
test: /\.js$/,
loader: 'babel-loader'
}]
}
}
return gulp.src(projectPath('js/app.js'))
.pipe(plumber({
errorHandler: errorHandler
}))
.pipe(webpack(webpackOptions))
.pipe(gulp.dest(distPath('js')))
});
import word from './home';
import $ from 'jquery';
Answer the question
In order to leave comments, you need to log in
I don't use Galp, I say right away...
Paths to modules are specified in the resolve section. You can specify aliases and any other.
//...
resolve: {
modules: [/*путь_к_папке_с_сорсом,*/ "node_modules"]
}
//...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question