-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.ts
51 lines (48 loc) · 1.2 KB
/
webpack.config.ts
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
import { resolve } from 'path'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import { VueLoaderPlugin } from 'vue-loader'
import Components from 'unplugin-vue-components/webpack'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import type { Configuration } from 'webpack'
const mode: 'production' | 'development' =
(process.env.MODE as any) ?? 'development'
const config: Configuration = {
mode,
entry: {
app: resolve('src', 'main.ts'),
},
resolve: {
extensions: ['.ts', '.js', '.mjs', '.json'],
},
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
{ test: /\.vue$/, loader: 'vue-loader' },
{
test: /\.m?[tj]s$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'public/index.html',
}),
Components({
resolvers: [ElementPlusResolver({})],
dts: resolve('src', 'components.d.ts'),
}),
],
}
export default config