-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb-dev-server.config.mjs
43 lines (35 loc) · 1.34 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
43
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
import { fromRollup } from '@web/dev-server-rollup';
import rollupCommonjs from '@rollup/plugin-commonjs';
import rollupReplace from '@rollup/plugin-replace';
const commonjs = fromRollup(rollupCommonjs);
const replace = fromRollup(rollupReplace);
/** Use Hot Module replacement by adding --hmr to the start command */
const hmr = process.argv.includes('--hmr');
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
open: '/',
watch: !hmr,
/** Resolve bare module imports */
nodeResolve: {
exportConditions: ['browser', 'development'],
},
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
// esbuildTarget: 'auto'
/** Set appIndex to enable SPA routing */
appIndex: './index.html',
plugins: [
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
commonjs({
include: [
// the commonjs plugin is slow, list the required packages explicitly:
'**/node_modules/color-scales/**/*',
],
}),
replace({
'process.env.NODE_ENV': JSON.stringify('dev'),
preventAssignment: true,
}),
],
// See documentation for all available options
});