Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] manually bundle worker in advance #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[FIX] manually bundle worker in advance #2

wants to merge 2 commits into from

Conversation

Flam9
Copy link
Collaborator

@Flam9 Flam9 commented Dec 6, 2022

Rather than fighting webpack (which I despise), I chose to bundle webtorrent and fs-chunk-store in a separate project using esbuild.

Build script

// build.js
const esbuild = require("esbuild");

const buildOptions = {
  bundle: true,
  minify: false,
  format: "esm",
  target: "esnext",
  platform: "node",
  banner: {
    js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
  },
  entryPoints: ["src/index.js"],
  outfile: "dist/index.js",
};

esbuild.buildSync(buildOptions);
node build.js

Then I took that output and dropped it into the worker file.

No more complaints.

@Flam9 Flam9 changed the title manually bundle worker in advance [FIX] manually bundle worker in advance Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant