-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathweb-dev-server.config.mjs
40 lines (35 loc) · 1.08 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
import { fromRollup } from '@web/dev-server-rollup';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { readFileSync } from 'fs';
import _commonjs from '@rollup/plugin-commonjs';
import _replace from '@rollup/plugin-replace';
import _graphql from '@apollo-elements/rollup-plugin-graphql';
const graphql = fromRollup(_graphql);
const replace = fromRollup(_replace);
const commonjs = fromRollup(_commonjs);
const cjsIncludes = [
'**/node_modules/**/*.cjs.js',
'**/node_modules/**/*.cjs',
'**/node_modules/fast-json-stable-stringify/index.js',
'**/graphql-tag/**/*',
'**/node_modules/zen-observable/**/*',
];
const DEPENDENCIES =
JSON.stringify(JSON.parse(readFileSync('./package.json', 'utf-8')).dependencies);
export default /** @type {import('@web/dev-server').DevServerConfig} */ {
nodeResolve: true,
appIndex: 'index.html',
port: 8765,
open: true,
rootDir: '.',
watch: true,
mimeTypes: {
'**/*.graphql': 'js',
},
plugins: [
esbuildPlugin({ ts: true }),
commonjs({ include: cjsIncludes }),
graphql(),
replace({ DEPENDENCIES }),
],
};