-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb-dev-server.config.js
More file actions
41 lines (35 loc) · 1.06 KB
/
web-dev-server.config.js
File metadata and controls
41 lines (35 loc) · 1.06 KB
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
/* eslint-disable no-console */
// eslint-disable-next-line import/no-extraneous-dependencies
import { esbuildPlugin } from '@web/dev-server-esbuild';
/** Use Hot Module replacement by adding --hmr to the start command */
const hmr = process.argv.includes('--hmr');
/** Plugin to log available routes */
function routeLoggerPlugin() {
return {
name: 'route-logger',
serverStart() {
const baseUrl = `http://localhost:8000`;
console.log('\n📡 Available routes:');
console.log(` • ${baseUrl}/demo/`);
console.log(` • ${baseUrl}/demo/typescript-demo.html`);
console.log(` • ${baseUrl}/demo/react-demo.html`);
console.log('');
},
};
}
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
watch: !hmr,
nodeResolve: {
exportConditions: ['browser', 'development'],
},
plugins: [
routeLoggerPlugin(),
/** Compile TypeScript/TSX on-the-fly for development */
esbuildPlugin({
ts: true,
tsx: true,
target: 'auto',
tsconfig: './tsconfig.json',
}),
],
});