-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
105 lines (104 loc) · 2.4 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
// const webpack = require('webpack')
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MonacoEditorPlugin = require('monaco-editor-webpack-plugin')
const WorkerPlugin = require('worker-plugin')
module.exports = {
// cache: {
// type: 'filesystem',
// buildDependencies: {
// config: [__filename]
// }
// },
// mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
// devtool:
// process.env.NODE_ENV === 'production'
// ? 'source-source-map'
// : 'eval-cheap-module-source-map',
entry: path.resolve(__dirname, './src/index.ts'),
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/'
},
resolve: {
extensions: ['.js', '.ts', '.tsx', '.vue', '.json', '.mjs', '.wasm'],
alias: {
vue: require.resolve('vue/dist/vue.esm-bundler.js'),
'uniroll-vue': require.resolve('uniroll-vue/dist/uniroll-vue.js')
}
},
module: {
rules: [
{
test: /\.vue$/,
use: 'vue-loader'
},
{
test: /\.tsx?$/,
use: {
loader: 'ts-loader',
options: {
happyPackMode: true,
transpileOnly: true,
appendTsSuffixTo: [/\.vue$/]
}
}
},
{
test: /\.worker\.ts$/i,
use: [
{
loader: 'comlink-loader',
options: {
singleton: true
}
},
{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
]
},
{
test: /\.png$/,
use: {
loader: 'url-loader',
options: { limit: 8192 }
}
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.ttf$/,
use: ['file-loader']
},
{
test: /\.js$/,
include: /pluginutils/, // for @rollup/pluginutils
type: 'javascript/auto'
}
]
},
plugins: [
new VueLoaderPlugin(),
new MonacoEditorPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src/index.html')
}),
new WorkerPlugin({
globalObject: 'self'
})
],
devServer: {
inline: true,
hot: true,
// stats: 'verbose',
contentBase: __dirname,
overlay: true
}
}