Skip to content

Commit 84aa693

Browse files
go back to bundling worker
1 parent cf73b2b commit 84aa693

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.github/workflows/publish.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ jobs:
4444
id: deployment
4545
uses: actions/deploy-pages@v4
4646
# Publish all dist at top level so that esm.sh can find web worker...
47-
- run: mv dist/* .
48-
- run: npm publish --provenance --access public
47+
- run: npm publish --provenance --access public package.tgz
4948
if: startsWith(github.ref, 'refs/tags/')
5049
env:
5150
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egraph-visualizer",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/saulshanabrook/egraph-visualizer.git"
@@ -42,6 +42,9 @@
4242
"typescript-eslint": "^8.0.1",
4343
"vite": "^5.4.1"
4444
},
45-
"main": "dom.js",
45+
"files": [
46+
"dist"
47+
],
48+
"main": "dist/dom.js",
4649
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
4750
}

src/Visualizer.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { ErrorBoundary } from "react-error-boundary";
88
import type { EdgeChange, EdgeProps, EdgeTypes, NodeChange, NodeProps } from "@xyflow/react";
99

1010
import ELK, { ElkExtendedEdge, ElkNode } from "elkjs/lib/elk-api";
11-
import ELKWorker from "elkjs/lib/elk-worker?worker";
11+
// Make worker inline because if its external cannot be loaded from esm.sh due to CORS
12+
import ELKWorker from "elkjs/lib/elk-worker?worker&inline";
1213

1314
import { createContext, memo, startTransition, Suspense, use, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
1415
import {

vite.config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export default defineConfig({
77
plugins: [react()],
88
base: "./",
99
build: {
10-
assetsInlineLimit: (path) => !path.includes("elk-worker"),
1110
lib: {
1211
entry: [resolve(__dirname, "src/anywidget.tsx"), resolve(__dirname, "src/dom.tsx")],
1312
formats: ["es"],

0 commit comments

Comments
 (0)