-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.ts
54 lines (51 loc) · 1.13 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
52
53
54
import glob from 'fast-glob'
import type { Configuration } from 'webpack'
const config: Configuration = {
mode: 'production',
entry: async () => {
const files = await glob([
'plugins/*/assets/**/*.ts',
'plugins/*/assets/**/*.tsx',
])
// @ts-ignore
return Object.fromEntries(
files
.filter((file) => !file.endsWith('.d.ts'))
.map((file) => [
file.replace('plugins/', '').replace(/\.tsx?$/g, ''),
`./${file}`,
]),
)
},
output: {
path: `${__dirname}/plugins`,
filename: '[name].js',
ecmaVersion: 2017,
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
{
test: /\.scss$/,
use: [
{ loader: 'style-loader', options: { esModule: true } },
{ loader: 'css-loader', options: { importLoaders: 1 } },
{ loader: 'sass-loader' },
],
},
],
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
'blessing-skin': 'blessing',
},
devtool: false,
}
export default config