2017-08-24 11:16:07 +02:00
|
|
|
var webpack = require('webpack');
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
|
|
|
|
// Naming and path settings
|
|
|
|
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') {
|
2017-08-30 12:55:11 +02:00
|
|
|
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
|
2017-08-24 11:16:07 +02:00
|
|
|
|
2017-08-30 12:55:11 +02:00
|
|
|
plugins.push(new UglifyJsPlugin({
|
2017-08-31 22:55:24 +02:00
|
|
|
minimize: true,
|
|
|
|
sourceMap: true
|
|
|
|
}
|
2017-08-30 12:55:11 +02:00
|
|
|
));
|
|
|
|
plugins.push(new webpack.DefinePlugin({
|
2017-08-31 22:55:24 +02:00
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"'
|
2017-08-30 12:55:11 +02:00
|
|
|
}
|
2017-08-31 22:55:24 +02:00
|
|
|
}
|
2017-08-30 12:55:11 +02:00
|
|
|
));
|
2017-08-24 11:16:07 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Main Settings config
|
|
|
|
module.exports = {
|
2017-09-25 12:31:39 +02:00
|
|
|
entry: {
|
|
|
|
lib: [
|
|
|
|
'intersection-observer',
|
|
|
|
'babel-polyfill',
|
|
|
|
'./src/lib/baseui.js'
|
|
|
|
],
|
|
|
|
main: [
|
|
|
|
'intersection-observer',
|
|
|
|
'babel-polyfill',
|
|
|
|
entryPoint
|
|
|
|
]
|
|
|
|
},
|
2017-08-30 12:55:11 +02:00
|
|
|
devtool: 'source-map',
|
|
|
|
output: {
|
|
|
|
path: exportPath,
|
2017-08-31 23:04:54 +02:00
|
|
|
publicPath: 'build/',
|
2017-09-25 12:31:39 +02:00
|
|
|
filename: 'baseui-[name].bundle.js',
|
|
|
|
library: 'baseUI',
|
|
|
|
libraryTarget: 'umd'
|
2017-08-30 12:55:11 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [{
|
2017-08-30 13:28:19 +02:00
|
|
|
enforce: "pre",
|
2017-08-30 12:55:11 +02:00
|
|
|
test: /\.(vue|js)$/,
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
exclude: /node_modules/
|
2017-08-31 22:55:24 +02:00
|
|
|
}, {
|
|
|
|
test: /\.(jpe?g|png|gif|woff|woff2|ttf|svg|eot)(\?.*)?$/i,
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[sha512:hash:base64:7].[ext]'
|
|
|
|
}
|
2017-08-30 12:55:11 +02:00
|
|
|
}, {
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader'
|
|
|
|
}, {
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /(node_modules|bower_components)/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
query: {
|
2017-09-01 17:49:37 +02:00
|
|
|
presets: ['es2015'],
|
|
|
|
plugins: ['syntax-dynamic-import']
|
2017-08-30 12:55:11 +02:00
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'vue$': 'vue/dist/vue.esm.js'
|
|
|
|
},
|
|
|
|
modules: [path.resolve(__dirname, "src"), "node_modules"],
|
|
|
|
extensions: [".vue", ".js", ".less"]
|
|
|
|
},
|
|
|
|
plugins
|
2017-08-24 11:16:07 +02:00
|
|
|
};
|