Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('scripts', (cb) => {
return gulp.src('app/scripts/*.js')
.pipe(plumber({
// Webpack will log the errors
errorHandler () {}
}))
.pipe(named())
.pipe(gulpWebpack({
devtool: args.sourcemaps ? 'inline-source-map' : false,
watch: args.watch,
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(ENV),
'process.env.VENDOR': JSON.stringify(args.vendor)
})
].concat(args.production ? [
new BabiliPlugin()
] : []),
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader'
}]
}
export function buildForTest() {
if (args.watch) {
return gulp.src(["tests/entry.js"])
.pipe(gulpWebpack(getWebpackConfig(true)))
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(espower())
.pipe(sourcemaps.write())
.pipe(gulp.dest("tmp/scripts"));
} else {
return gulp.src(["tests/entry.js"])
.pipe(gulpWebpack(getWebpackConfig(true)))
.pipe(gulp.dest("tmp/scripts"));
}
}
output: {
filename: '[id].worker.js'
}
}
}
if (developmentMode) {
config.devtool = 'inline-source-map'
} else {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.NoErrorsPlugin()
)
}
return gulp.src('')
.pipe(webpackStream(config, null, (err, stats) => {
if (!err) {
$.util.log(stats.toString({
colors: $.util.colors.supportsColor,
chunks: !developmentMode,
chunkModules: !developmentMode
}))
browserSync.reload()
}
}))
.pipe(gulp.dest('./public'))
})
gulp.task('build:example:webpack', () => gulp
.src(['example/app/app.js'])
.pipe(webpackStream(exampleWebpackConfig, webpack))
.pipe(gulp.dest('example/dist')));
gulp.task('build:example:webpack', () => gulp
.src(['example/app/app.js'])
.pipe(webpackStream(exampleWebpackConfig, webpack))
.pipe(gulp.dest('example/dist')));
const functionWebpack = () => {
return gulp.src('src/houston/public/scripts/app.js')
.pipe(gulpWebpack(webpackConfig, webpack))
.pipe(gulp.dest('build/houston/public/scripts'))
}
gulp.task('build:example:webpack', () => {
return gulp
.src(['example/app/app.js'])
.pipe(webpackStream(exampleWebpackConfig, webpack))
.pipe(gulp.dest('example/dist'));
});
gulp.task("scripts", () => {
return gulp.src(paths.scripts.src)
.pipe(webpackStream(webpackConfig), webpack)
.pipe(gulpif(production, rename({
suffix: ".min"
})))
.pipe(gulp.dest(paths.scripts.dist))
.pipe(debug({
"title": "JS files"
}))
.on("end", browsersync.reload);
});
gulp.task('webpack', () => {
if (production) {
webpackConfig.plugins.push(new webpack.optimize.UglifyJsPlugin())
} else {
webpackConfig.devtool = 'source-map'
}
return gulp
.src(config.tasks.webpack.src)
.pipe(plumber())
.pipe(webpackStream(webpackConfig, webpack))
.pipe(gulp.dest(config.tasks.webpack.dest))
})