-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
108 lines (96 loc) · 2.92 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const path = require('path');
const webpack = require('webpack');
const version = require('./package.json').version;
const peerDependencies = require('./package.json').peerDependencies;
// const LodashModuleReplacementPlugin = require("lodash-webpack-plugin");
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const banner = `
/**
* vue-aw-components ${version}
* https://github.com/enyosolutions-team/vue-aw-components/
* Released under the MIT License.
*/
`;
function getProdExternals() {
Object.keys(peerDependencies).forEach(k => peerDependencies[k] = k)
return peerDependencies;
}
let plugins = [];
let optimization = {};
// comment line to disable analyzer
// plugins.push(new BundleAnalyzerPlugin());
const externals = process.env.NODE_ENV === 'production' ?
getProdExternals() : {};
externals['core-js'] = 'core-js';
// externals['sweetalert2'] = 'sweetalert2';
// externals['sweetalert2/dist'] = 'sweetalert2/dist';
// externals['sweetalert2/dist/sweetalert2.js'] = 'sweetalert2/dist/sweetalert2.js';
module.exports = {
lintOnSave: false,
filenameHashing: false,
runtimeCompiler: false,
transpileDependencies: [],
productionSourceMap: false,
configureWebpack: {
externals,
plugins,
optimization,
resolve: {
alias: {
'vue-aw-components': path.resolve(__dirname, 'src'),
vue$: path.resolve(__dirname, 'node_modules/vue/dist/vue.esm.js'),
},
symlinks: false,
}
},
devServer: {
proxy: 'http://localhost:4444',
},
chainWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
config.externals = externals;
// config.externals = {
// 'vue-multiselect': 'vue-multiselect',
// 'sweetalert2': 'sweetalert2',
// 'sweetalert2/dist': 'sweetalert2/dist',
// 'vue2-daterange-picker': 'vue2-daterange-picker',
// 'vue-form-generator': 'vue-form-generator',
// 'vue-good-table': 'vue-good-table',
// 'core-js': 'core-js',
// // 'axios': 'axios',
// 'lodash': 'lodash',
// 'qs': 'qs',
// };
config.plugin('banner').use(webpack.BannerPlugin, [
{
banner,
raw: true,
entryOnly: true
}
]);
// config.plugin("lodash").use(LodashModuleReplacementPlugin, [
// {
// cloning: true,
// caching: true,
// collections: true,
// guards: true,
// deburring: true,
// unicode: true,
// chaining: true,
// coercions: true,
// flattening: true,
// paths: true,
// placeholders: true,
// shorthands: false,
// currying: false,
// metadata: false,
// exotics: false,
// memoizing: false,
// }
// ]);
}
else {
config.resolve.alias.set('vue-aw-components', path.resolve(__dirname, 'src'));
}
}
};