baseui/webpack.config.js

75 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-08-24 11:16:07 +02:00
var webpack = require('webpack');
var path = require('path');
// Naming and path settings
var appName = 'app';
var entryPoint = './src/main.js';
var exportPath = path.resolve(__dirname, './build');
// Enviroment flag
var plugins = [];
var env = process.env.WEBPACK_ENV;
// Differ settings based on production flag
if (env === 'production') {
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
2017-08-29 15:51:50 +02:00
plugins.push(new UglifyJsPlugin({
2017-08-24 11:16:07 +02:00
minimize: true,
sourceMap: true
}
));
plugins.push(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}
));
appName = appName + '.js';
} else {
appName = appName + '.js';
}
// Main Settings config
module.exports = {
2017-08-24 19:28:53 +02:00
entry: [
'intersection-observer',
2017-08-29 15:51:50 +02:00
'babel-polyfill',
2017-08-24 19:28:53 +02:00
entryPoint
],
2017-08-24 11:16:07 +02:00
devtool: 'source-map',
output: {
path: exportPath,
publicPath: '/build',
filename: appName
},
module: {
loaders: [
{
test: /\.(vue|js)$/,
loader: 'eslint-loader',
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
plugins
};