-
Notifications
You must be signed in to change notification settings - Fork 46
/
vue.config.js
101 lines (97 loc) · 3 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
const path = require('path');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const yargs = require('yargs');
const CopyPlugin = require('copy-webpack-plugin');
// eslint-disable-next-line no-unused-vars
const CircularDependencyPlugin = require('circular-dependency-plugin');
module.exports = {
runtimeCompiler: true,
lintOnSave: process.env.NODE_ENV !== 'production',
css: {
extract: false,
loaderOptions: {
sass: {
prependData: `
@import '@/assets/scss/settings/_settings.variables.scss';
@import '@/assets/scss/tools/_tools.chevron.scss';
`,
},
},
},
transpileDependencies: ['bpmnlint'],
configureWebpack: {
resolve: {
modules: [
path.resolve(__dirname, 'node_modules'),
'node_modules',
],
symlinks: false,
alias: {
jointjs$: process.env.NODE_ENV === 'development'
? 'jointjs/dist/joint.js'
: 'jointjs',
},
},
module: {
rules: [
{
test: /\.bpmnlintrc$/,
use: 'bpmnlint-loader',
},
],
},
externals: (() => {
const externals = [];
if (process.env.NODE_ENV === 'production') {
externals.push(
'vue',
/^bootstrap\/.+$/,
/^@processmaker\/(?!processmaker-bpmn-moddle).+$/,
/^@fortawesome\/.+$/,
'jointjs',
'i18next',
'@panter/vue-i18next',
'luxon',
'lodash',
'bpmn-moddle',
);
}
// when running in development mode (npm run dev and cypress)
if (process.env.NODE_ENV === 'development') {
// reduce the chunk-vendors size
externals.push('@processmaker/screen-builder/dist/vue-form-builder');
}
return externals;
})(),
plugins: (() => {
const argv = yargs
.boolean('analyze')
.argv;
const plugins = [];
if (argv.analyze) {
plugins.push(new BundleAnalyzerPlugin());
}
/* copy files required for dynamic import of rich text editor */
plugins.push(new CopyPlugin([{
from: path.resolve(__dirname, 'node_modules/@processmaker/vue-form-elements/dist'),
to: path.resolve(__dirname, 'public/js'),
ignore: ['demo.html'],
}]));
/* use this plugin to find issues related to circular dependencies */
// plugins.push(new CircularDependencyPlugin({
// // exclude detection of files based on a RegExp
// exclude: /a\.js|node_modules/,
// // include specific files based on a RegExp
// include: /src/,
// // add errors to webpack instead of warnings
// failOnError: true,
// // allow import cycles that include an asyncronous import,
// // e.g. via import(/* webpackMode: "weak" */ './file.js')
// allowAsyncCycles: false,
// // set the current working directory for displaying module paths
// cwd: process.cwd(),
// }));
return plugins;
})(),
},
};