Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new webpackPlugins.WebpackChunkHashPlugin()
);
}
if (Mix.options.purifyCss) {
let PurifyCSSPlugin = require('purifycss-webpack');
// By default, we'll scan all Blade and Vue files in our project.
let paths = glob.sync(Mix.Paths.root('resources/views/**/*.blade.php')).concat(
Mix.entry().scripts.reduce((carry, js) => {
return carry.concat(glob.sync(js.base + '/**/*.vue'));
}, [])
);
plugins.push(new PurifyCSSPlugin(
Object.assign({paths}, Mix.options.purifyCss, {minimize : Mix.inProduction})
));
}
if (Mix.inProduction && Mix.options.uglify) {
plugins.push(
new webpack.optimize.UglifyJsPlugin(Mix.options.uglify)
);
}
plugins.push(
new webpack.DefinePlugin(
Mix.definitions({
NODE_ENV : Mix.inProduction
? 'production'
: ( process.env.NODE_ENV || 'development' )
})
new webpackPlugins.WebpackChunkHashPlugin()
);
}
if (Mix.options.purifyCss) {
let PurifyCSSPlugin = require('purifycss-webpack');
// By default, we'll scan all Blade and Vue files in our project.
let paths = glob.sync(Mix.Paths.root('resources/views/**/*.blade.php')).concat(
Mix.js.reduce((carry, js) => {
return carry.concat(glob.sync(js.entry.map(entry => entry.base) + '/**/*.vue'));
}, [])
);
plugins.push(new PurifyCSSPlugin(
Object.assign({ paths }, Mix.options.purifyCss, { minimize: Mix.inProduction })
));
}
if (Mix.inProduction) {
plugins.push(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin(Mix.options.uglify)
);
}
plugins.push(
// jQuery: 'jquery',
// $: 'jquery',
// jquery: 'jquery'
// }),
new plugins.FriendlyErrorsWebpackPlugin(),
new plugins.StatsWriterPlugin({
filename: 'mix-manifest.json',
transform: Mix.manifest.transform.bind(Mix.manifest),
}),
new plugins.WebpackMd5HashPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: Mix.inProduction,
options: {
postcss: Mix.options.postCss,
context: __dirname,
output: { path: './' }
}
})
]);
if (Mix.browserSync) {
module.exports.plugins.push(
new plugins.BrowserSyncPlugin(
Object.assign({
host: 'localhost',
port: 3000,
proxy: 'app.dev',
// $: 'jquery',
// jquery: 'jquery',
// 'window.jQuery': 'jquery'
// }),
new plugins.FriendlyErrorsWebpackPlugin(),
new plugins.StatsWriterPlugin({
filename: 'mix-manifest.json',
transform: Mix.manifest.transform.bind(Mix.manifest),
}),
new plugins.WebpackMd5HashPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: Mix.inProduction,
options: {
postcss: [
require('autoprefixer')
],
context: __dirname,
output: { path: './' }
}
})
]);
if (Mix.notifications) {
module.exports.plugins.push(
new plugins.WebpackNotifierPlugin({
title: 'Laravel Mix',
alwaysNotify: true,
$: 'jquery',
jquery: 'jquery',
'window.jQuery': 'jquery'
}),
new plugins.FriendlyErrorsWebpackPlugin(),
// new plugins.StatsWriterPlugin({
// filename: 'mix-manifest.json',
// transform: Mix.manifest.transform.bind(Mix.manifest),
// }),
new plugins.WebpackMd5HashPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: Mix.inProduction,
options: {
postcss: [
require('autoprefixer')
],
context: __dirname,
output: { path: './' }
}
})
]);
if (Mix.notifications) {
module.exports.plugins.push(
new plugins.WebpackNotifierPlugin({
title: 'Laravel Mix',
alwaysNotify: true,
| extensions, for versioning, OS notifications, and much more.
|
*/
plugins.push(
new webpack.ProvidePlugin(Mix.autoload || {}),
new webpackPlugins.FriendlyErrorsWebpackPlugin({ clearConsole: Mix.options.clearConsole }),
new webpackPlugins.StatsWriterPlugin({
filename: 'mix-manifest.json',
transform: Mix.manifest.transform.bind(Mix.manifest),
}),
new webpack.LoaderOptionsPlugin({
minimize: Mix.inProduction,
options: {
postcss: Mix.options.postCss,
context: __dirname,
output: { path: './' }
}
})
);
if (Mix.browserSync) {
plugins.push(
new webpackPlugins.BrowserSyncPlugin(
Object.assign({
host: 'localhost',
port: 3000,
proxy: 'app.dev',
files: [
}
if (Mix.extract) {
module.exports.plugins.push(
new webpack.optimize.CommonsChunkPlugin({
names: Mix.entryBuilder.extractions.concat([
path.join(Mix.js.base, 'manifest')
]),
minChunks: Infinity
})
);
}
if (Mix.inProduction) {
module.exports.plugins = module.exports.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
/*
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false,
drop_console: true
}
})
*/
plugins.push(new PurifyCSSPlugin(
Object.assign({ paths }, Mix.options.purifyCss, { minimize: Mix.inProduction })
));
}
if (Mix.inProduction && Mix.options.uglify) {
plugins.push(
new webpack.optimize.UglifyJsPlugin(Mix.options.uglify)
);
}
plugins.push(
new webpack.DefinePlugin(
Mix.definitions({
NODE_ENV: Mix.inProduction
? 'production'
: ( process.env.NODE_ENV || 'development' )
})
),
new webpackPlugins.WebpackOnBuildPlugin(
stats => global.events.fire('build', stats)
)
);
if (! Mix.entry().hasScripts()) {
plugins.push(new webpackPlugins.MockEntryPlugin(Mix.output().path));
}
module.exports.plugins = plugins;
let path = require('path');
let glob = require('glob');
let webpack = require('webpack');
let Mix = require('laravel-mix').config;
let webpackPlugins = require('laravel-mix').plugins;
let SmartBannerPlugin = require('smart-banner-webpack-plugin');
let min = Mix.inProduction ? '.min' : '';
/*
|--------------------------------------------------------------------------
| Mix Initialization
|--------------------------------------------------------------------------
|
| As our first step, we'll require the project's Laravel Mix file
| and record the user's requested compilation and build steps.
| Once those steps have been recorded, we may get to work.
|
*/
Mix.initialize();
/*
|--------------------------------------------------------------------------
}
if (Mix.extract) {
module.exports.plugins.push(
new webpack.optimize.CommonsChunkPlugin({
names: Mix.entryBuilder.extractions.concat([
path.join(Mix.js.base, 'manifest')
]),
minChunks: Infinity
})
);
}
if (Mix.inProduction) {
module.exports.plugins = module.exports.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false,
drop_console: true
}
})
]);
}