Skip to content

Commit

Permalink
bundle worktop (#4473)
Browse files Browse the repository at this point in the history
* bundle worktop

* build on prepublishOnly

* Update packages/adapter-cloudflare/tsconfig.json

* update builder file paths

Co-authored-by: Luke Edwards <[email protected]>
  • Loading branch information
Rich-Harris and lukeed authored Mar 31, 2022
1 parent 2ce5407 commit 77702f9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions packages/adapter-cloudflare/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.DS_Store
node_modules
target
/files
4 changes: 2 additions & 2 deletions packages/adapter-cloudflare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function (options = {}) {
})};\n\nexport const prerendered = new Set(${JSON.stringify(builder.prerendered.paths)});\n`
);

builder.copy(`${files}/worker.ts`, `${tmp}/_worker.ts`, {
builder.copy(`${files}/worker.js`, `${tmp}/_worker.js`, {
replace: {
SERVER: `${relativePath}/index.js`,
MANIFEST: './manifest.js'
Expand All @@ -40,7 +40,7 @@ export default function (options = {}) {
target: 'es2020',
platform: 'browser',
...options,
entryPoints: [`${tmp}/_worker.ts`],
entryPoints: [`${tmp}/_worker.js`],
outfile: `${dest}/_worker.js`,
allowOverwrite: true,
format: 'esm',
Expand Down
4 changes: 3 additions & 1 deletion packages/adapter-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
],
"main": "index.js",
"scripts": {
"build": "esbuild src/worker.ts --bundle --outfile=files/worker.js --external:SERVER --external:MANIFEST --format=esm",
"lint": "eslint --ignore-path .gitignore \"**/*.{ts,js,svelte}\" && npm run check-format",
"format": "npm run check-format -- --write",
"check": "tsc --skipLibCheck",
"check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore"
"check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
"prepublishOnly": "npm run build"
},
"dependencies": {
"esbuild": "^0.14.21",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"@sveltejs/kit": ["../kit/types/index"]
}
},
"include": ["**/*.js", "ambient.d.ts", "files/worker.ts"]
"include": ["index.js", "ambient.d.ts", "src/worker.ts"]
}

0 comments on commit 77702f9

Please sign in to comment.