forked from QwikDev/qwik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsm.cjs
50 lines (48 loc) · 1.21 KB
/
tsm.cjs
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
const { join } = require('node:path');
const { pathToFileURL } = require('node:url');
const corePath = pathToFileURL(join(__dirname, 'packages', 'qwik', 'src', 'core', 'index.ts'));
if (
typeof global !== 'undefined' &&
typeof globalThis.fetch !== 'function' &&
typeof process !== 'undefined' &&
process.versions.node
) {
if (!globalThis.fetch) {
const { fetch, Headers, Request, Response, FormData } = require('undici');
globalThis.fetch = fetch;
globalThis.Headers = Headers;
globalThis.Request = Request;
globalThis.Response = Response;
globalThis.FormData = FormData;
}
}
module.exports = {
common: {
minifyWhitespace: true,
target: 'es2020',
},
config: {
'.tsx': {
jsxFactory: 'qwikJsx.h',
jsxFragment: 'qwikJsx.Fragment',
banner: `
globalThis.qTest = true;
globalThis.qRuntimeQrl = true;
globalThis.qDev = true;
globalThis.qInspector = false;
import * as qwikJsx from "${corePath}";`,
target: 'es2020',
loader: 'tsx',
minify: false,
},
'.ts': {
loader: 'ts',
banner: `
globalThis.qTest = true;
globalThis.qRuntimeQrl = true;
globalThis.qDev = true;
`,
minify: false,
},
},
};