53 lines
1.0 KiB
JavaScript
Executable File
53 lines
1.0 KiB
JavaScript
Executable File
var webpack = require('webpack');
|
|
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
|
|
var path = require('path');
|
|
var env = require('yargs').argv.mode;
|
|
|
|
var libraryName = 'frappe-gantt';
|
|
|
|
var plugins = [], outputFile;
|
|
|
|
if (env === 'build') {
|
|
plugins.push(new UglifyJsPlugin({ minimize: true }));
|
|
outputFile = libraryName + '.min.js';
|
|
} else {
|
|
outputFile = libraryName + '.js';
|
|
}
|
|
|
|
let config = {
|
|
entry: __dirname + '/src/Gantt.js',
|
|
devtool: 'source-map',
|
|
output: {
|
|
path: __dirname + '/dist',
|
|
filename: outputFile,
|
|
library: 'Gantt',
|
|
libraryTarget: 'umd',
|
|
umdNamedDefine: true
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{
|
|
test: /(\.jsx|\.js)$/,
|
|
loader: 'babel',
|
|
exclude: /(node_modules|bower_components)/
|
|
},
|
|
{
|
|
test: /(\.jsx|\.js)$/,
|
|
loader: 'eslint-loader',
|
|
exclude: /node_modules/
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
loaders: [ 'style', 'css?sourceMap', 'sass?sourceMap' ]
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
root: path.resolve('./src'),
|
|
extensions: ['', '.js']
|
|
},
|
|
plugins: plugins
|
|
};
|
|
|
|
module.exports = config;
|