Update dependencies

This commit is contained in:
Christoph Wiechert
2018-12-14 15:19:47 +01:00
parent 5fb623b512
commit 0260c734e0
15 changed files with 5586 additions and 5029 deletions

View File

@@ -1,5 +1,7 @@
const path = require('path');
const webpack = require('webpack');
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const { VueLoaderPlugin } = require('vue-loader');
const execSync = require('child_process').execSync;
let commitShaId;
@@ -8,7 +10,10 @@ try {
commitShaId = '#'+execSync('git rev-parse HEAD').toString().substr(0,10);
} catch (e) {}
const mode = process.env.NODE_ENV || 'development';
module.exports = {
mode,
entry: {
upload: './src/upload.js',
download: './src/download.js',
@@ -19,29 +24,54 @@ module.exports = {
publicPath: '/app/',
filename: '[name].js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
filename: "common.js",
name: "common"
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV !== 'development' ? 'production' : 'development'),
PSITRANSFER_VERSION: JSON.stringify(process.env.PSITRANSFER_VERSION || commitShaId || 'dev')
}),
],
optimization: {
splitChunks: {
chunks: 'all',
name: 'common'
}
},
// devtool: 'source-map',
devtool: 'none',
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
exclude: /node_modules\/(?!(vue-awesome|)\/).*/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', {
modules: false,
"useBuiltIns": "usage",
"targets": ["last 2 version", "ie 11", "not dead"]
}]],
}
}
},
{
test: /\.pug$/,
oneOf: [
// this applies to `<template lang="pug">` in Vue components
{
resourceQuery: /^\?vue/,
use: ['pug-plain-loader']
},
// this applies to pug imports inside JavaScript
{
use: ['raw-loader', 'pug-plain-loader']
}
]
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader',
]
},
{
test: /\.(png|jpg|gif|svg)$/,
@@ -54,13 +84,21 @@ module.exports = {
},
resolve: {
alias: {
'vue$': process.env.NODE_ENV !== 'development' ? 'vue/dist/vue.runtime.min.js' : 'vue/dist/vue.runtime.js'
'vue$': mode !== 'development' ? 'vue/dist/vue.runtime.min.js' : 'vue/dist/vue.runtime.js'
}
},
plugins: [
new VueLoaderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(mode),
PSITRANSFER_VERSION: JSON.stringify(process.env.PSITRANSFER_VERSION || commitShaId || 'dev')
}),
],
devServer: {
historyApiFallback: true,
noInfo: true,
noInfo: false,
disableHostCheck: true,
host: '0.0.0.0',
proxy: [
// Proxy requests to BE in DEV mode
// https://webpack.github.io/docs/webpack-dev-server.html#proxy
@@ -73,24 +111,8 @@ module.exports = {
performance: {
hints: false
},
devtool: '#eval-source-map'
};
if (process.env.NODE_ENV !== 'development') {
module.exports.devtool = '#source-map';
let commit;
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = [
...module.exports.plugins,
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
];
if(process.env.ANALYZE) {
module.exports.plugins.push(new BundleAnalyzerPlugin());
}