Compile one unminified file for devs

This commit is contained in:
Josh Johnson 2016-08-23 07:24:45 +01:00
parent 7207ee543f
commit fb8d5dbe47
3 changed files with 5220 additions and 15 deletions

5198
assets/scripts/dist/choices.js vendored Normal file

File diff suppressed because it is too large Load diff

1
assets/scripts/dist/choices.js.map vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -2,30 +2,20 @@ var path = require('path');
var package = require('./package.json'); var package = require('./package.json');
var webpack = require('webpack'); var webpack = require('webpack');
var wrapperPlugin = require('wrapper-webpack-plugin'); var wrapperPlugin = require('wrapper-webpack-plugin');
var banner = `/*! ${ package.name } v${ package.version } | (c) ${ new Date().getFullYear() } ${ package.author } | ${ package.homepage } */ \n` var banner = `/*! ${ package.name } v${ package.version } | (c) ${ new Date().getFullYear() } ${ package.author } | ${ package.homepage } */ \n`;
var minimize = process.argv.indexOf('--minimize') !== -1;
module.exports = { var config = {
devtool: 'cheap-module-source-map', devtool: 'cheap-module-source-map',
entry: [ entry: [
'./assets/scripts/src/choices' './assets/scripts/src/choices'
], ],
output: { output: {
path: path.join(__dirname, '/assets/scripts/dist'), path: path.join(__dirname, '/assets/scripts/dist'),
filename: 'choices.min.js', filename: minimize ? 'choices.min.js' : 'choices.js',
publicPath: '/assets/scripts/dist/' publicPath: '/assets/scripts/dist/'
}, },
plugins: [ plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
mangle: true,
output: {
comments: false
},
compress: {
warnings: false,
screw_ie8: true
}
}),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
// This has effect on the react lib size // This has effect on the react lib size
@ -44,4 +34,20 @@ module.exports = {
include: path.join(__dirname, 'assets/scripts/src') include: path.join(__dirname, 'assets/scripts/src')
}] }]
} }
}; };
if (minimize) {
config.plugins.unshift(new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
mangle: true,
output: {
comments: false
},
compress: {
warnings: false,
screw_ie8: true
}
}));
}
module.exports = config;