UNPKG

1.94 kBJavaScriptView Raw
1const path = require('path');
2const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
3const yargs = require('yargs');
4const CopyPlugin = require('copy-webpack-plugin');
5
6module.exports = {
7 css: {
8 extract: false,
9 loaderOptions: {
10 sass: {
11 prependData: `
12 @import '@/assets/scss/settings/_settings.variables.scss';
13 @import '@/assets/scss/tools/_tools.chevron.scss';
14 `,
15 },
16 },
17 },
18 transpileDependencies: ['bpmnlint'],
19 configureWebpack: {
20 resolve: {
21 modules: [
22 path.resolve(__dirname, 'node_modules'),
23 'node_modules',
24 ],
25 symlinks: false,
26 alias: {
27 jointjs$: process.env.NODE_ENV === 'development'
28 ? 'jointjs/dist/joint.js'
29 : 'jointjs',
30 },
31 },
32 module: {
33 rules: [
34 {
35 test: /\.bpmnlintrc$/,
36 use: 'bpmnlint-loader',
37 },
38 ],
39 },
40 externals: (() => {
41 const externals = [];
42 if (process.env.NODE_ENV === 'production') {
43 externals.push(
44 'vue',
45 /^bootstrap\/.+$/,
46 /^@processmaker\/(?!processmaker-bpmn-moddle).+$/,
47 /^@fortawesome\/.+$/,
48 'jointjs',
49 'i18next',
50 '@panter/vue-i18next',
51 'luxon',
52 'lodash',
53 'bpmn-moddle',
54 );
55 }
56 return externals;
57 })(),
58 plugins: (() => {
59 const argv = yargs
60 .boolean('analyze')
61 .argv;
62 const plugins = [];
63 if (argv.analyze) {
64 plugins.push(new BundleAnalyzerPlugin());
65 }
66
67 /* copy files required for dynamic import of rich text editor */
68 plugins.push(new CopyPlugin([{
69 from: path.resolve(__dirname, 'node_modules/@processmaker/vue-form-elements/dist'),
70 to: path.resolve(__dirname, 'public/js'),
71 ignore: ['demo.html'],
72 }]));
73
74 return plugins;
75 })(),
76 },
77};