-
Notifications
You must be signed in to change notification settings - Fork 0
/
web-dev-server.config.mjs
42 lines (40 loc) · 1.02 KB
/
web-dev-server.config.mjs
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
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { rollupAdapter, fromRollup } from '@web/dev-server-rollup';
import replace from '@rollup/plugin-replace';
import json from '@rollup/plugin-json';
const config = {
appIndex: 'index.html',
mimeTypes: {
// serve all json files as js
'**/*.json': 'js'
// serve .module.css files as js
// '**/*.module.css': 'js',
},
nodeResolve: true,
plugins: [
esbuildPlugin({ target: 'auto' }),
...(process.env.NODE_ENV
? [
fromRollup(
replace
)({
preventAssignment: true,
include: 'client/**/*.js',
exclude: 'client/config.*.js',
delimiters: ['', ''],
values: {
'./config': `./config.${process.env.NODE_ENV}`
}
}),
rollupAdapter(json())
]
: [])
],
devServer: {
historyApiFallback: {
rewrites: [{ from: /\//, to: '/404.html' }]
}
}
};
console.log(config);
export default config;