forked from vrcx-team/VRCX
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
127 lines (126 loc) · 3.47 KB
/
webpack.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');
module.exports = {
entry: {
vendor: [
'element-ui',
'noty',
'vue',
'vue-data-tables',
'vue-lazyload'
],
app: {
import: ['./src/app.js', './src/app.scss'],
dependOn: 'vendor'
},
'theme.dark': './src/theme.dark.scss',
'theme.darkvanillaold': './src/theme.darkvanillaold.scss',
'theme.darkvanilla': './src/theme.darkvanilla.scss',
'theme.pink': './src/theme.pink.scss',
'theme.material3': './src/theme.material3.scss',
flags: './src/flags.scss',
'animated-emoji': './src/animated-emoji.scss',
'emoji.font': './src/emoji.font.scss',
vr: {
import: ['./src/vr.js', './src/vr.scss'],
dependOn: 'vendor'
}
},
output: {
path: path.resolve(__dirname, 'build/html'),
filename: '[name].js',
library: {
type: 'window'
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.pug$/,
oneOf: [
{
resourceQuery: /^\?vue/,
use: 'pug-plain-loader'
},
{
use: ['raw-loader', 'pug-plain-loader']
}
]
},
{
test: /\.s?css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
},
{
test: /\.(eot|png|svg|ttf|woff)/,
type: 'asset',
generator: {
filename: 'assets/[name][ext]'
}
}
]
},
resolve: {
extensions: ['.css', '.js', '.scss'],
alias: {
vue: 'vue/dist/vue.common.js'
}
},
performance: {
hints: false
},
devtool: 'inline-source-map',
target: ['web', 'es2020'],
stats: {
preset: 'errors-only',
builtAt: true,
timings: true
},
plugins: [
new webpack.DefinePlugin({
LINUX: JSON.stringify(process.env.PLATFORM === 'linux'),
WINDOWS: JSON.stringify(process.env.PLATFORM === 'windows')
}),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: '[name].css'
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/index.pug',
inject: false,
minify: false
}),
new HtmlWebpackPlugin({
filename: 'vr.html',
template: './src/vr.pug',
inject: false,
minify: false
}),
new CopyPlugin({
patterns: [
// assets
{
from: './images/',
to: './images/'
}
]
})
],
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false
})
]
}
};