forked from QwikDev/qwik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsm.cjs
58 lines (54 loc) · 1.3 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
51
52
53
54
55
56
57
58
const { join } = require('node:path');
const { pathToFileURL } = require('node:url');
const corePath = pathToFileURL(join(__dirname, 'packages', 'qwik', 'src', 'core', 'index.ts'));
const bannerTS = `
globalThis.qTest = true;
globalThis.qRuntimeQrl = true;
globalThis.qDev = true;
`;
const bannerTSX = `
globalThis.qTest = true;
globalThis.qRuntimeQrl = true;
globalThis.qDev = true;
globalThis.qInspector = false;
import * as qwikJsx from "${corePath}";`;
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',
},
sourcemap: 'inline',
config: {
'.html': {
loader: 'text',
},
'.tsx': {
jsxFactory: 'qwikJsx.h',
jsxFragment: 'qwikJsx.Fragment',
banner: bannerTSX,
target: 'es2020',
loader: 'tsx',
minify: false,
},
'.ts': {
loader: 'ts',
banner: bannerTS,
minify: false,
},
},
};