Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
executable file
·108 lines (104 loc) · 3.31 KB
/
Copy pathwebpack.config.js
File metadata and controls
executable file
·108 lines (104 loc) · 3.31 KB
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 { VueLoaderPlugin } = require('vue-loader');
const webpack = require('webpack');
const isDev = process.env.NODE_ENV === 'development';
const isAnalyze = process.env.ANALYZE === 'true';
// Conditionally load bundle analyzer
const plugins = [
new VueLoaderPlugin(),
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: JSON.stringify(true),
__VUE_PROD_DEVTOOLS__: JSON.stringify(isDev),
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(isDev),
appName: JSON.stringify('intravox')
})
];
if (isAnalyze) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'server',
openAnalyzer: true
}));
}
module.exports = {
entry: {
main: './src/main.js',
admin: './src/admin.js'
},
output: {
filename: 'intravox-[name].js',
chunkFilename: 'intravox-[name].[contenthash:8].js',
path: path.resolve(__dirname, 'js'),
clean: true
},
optimization: {
splitChunks: {
chunks: 'all',
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
priority: -10,
},
shared: {
name: 'shared',
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
},
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
// Template comments are for developers and translators (the
// TRANSLATORS hints the Transifex extractor reads from source).
// Kept, Vue renders each one as a comment node: it ships in the
// bundle and a component that takes its first slot node as
// its label would get the comment instead.
compilerOptions: { comments: false },
},
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.js$/,
loader: 'string-replace-loader',
include: path.resolve(__dirname, 'node_modules/@nextcloud/vue'),
options: {
search: '"appName"',
replace: '"intravox"',
flags: 'g'
}
}
]
},
plugins,
resolve: {
extensions: ['.js', '.vue'],
alias: {
'@': path.resolve(__dirname, 'src'),
'vue': 'vue/dist/vue.runtime.esm-bundler.js'
},
fallback: {
'path': false,
'fs': false,
'crypto': false,
'stream': false,
'string_decoder': false,
'buffer': false,
'os': false,
'http': false,
'https': false,
'zlib': false
}
},
mode: isDev ? 'development' : 'production',
devtool: isDev ? 'source-map' : false
};