Skip to content

Commit 3bdf0d2

Browse files
authoredMay 5, 2021
create new server-build, for server side use cases (#1055)
1 parent e08c069 commit 3bdf0d2

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
 

‎config/rollup.worker-thread.js

+22
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,28 @@ const compilePlugins = [
3131
// So, here we continue to use the '.mjs' extension to indicate newer ECMASCRIPT support
3232
// but ensure the code can be run within a worker by putting it inside a named iife.
3333
const ESModules = [
34+
{
35+
input: 'output/worker-thread/server-lib.js',
36+
output: {
37+
file: 'dist/server-lib.mjs',
38+
format: 'es',
39+
name: 'ServerLib',
40+
sourcemap: true,
41+
},
42+
plugins: [
43+
replace({
44+
values: {
45+
WORKER_DOM_DEBUG: false,
46+
},
47+
preventAssignment: true,
48+
}),
49+
babelPlugin({
50+
transpileToES5: false,
51+
allowConsole: false,
52+
}),
53+
...compilePlugins,
54+
],
55+
},
3456
{
3557
input: 'output/worker-thread/index.js',
3658
output: {

‎src/worker-thread/server-lib.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Document } from './dom/Document';
2+
import { GlobalScope } from './WorkerDOMGlobalScope';
3+
4+
export function createDocument() {
5+
const win: GlobalScope = {} as any;
6+
return new Document(win);
7+
}

0 commit comments

Comments
 (0)
Please sign in to comment.