import webpack from "webpack-stream"; export const js = () => { return app.gulp.src(app.path.src.js, { sourcemaps: app.isDev }) .pipe(app.plugins.plumber( app.plugins.notify.onError({ title: "JS", message: "Error: <%= error.message %>" })) ) .pipe(webpack({ mode: app.isBuild ? 'production' : 'development', output: { filename: 'app.min.js', }, module: { rules: [ { test: /\.(png|jpe?g|gif|svg)$/i, use: [ { loader: 'file-loader', options: { name: '../img/app/[name].[ext]', }, }, ], }, ], }, })) .pipe(app.gulp.dest(app.path.build.js)) .pipe(app.plugins.browsersync.stream()); }