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

Switch to esbuild? #7

Open
hoodmane opened this issue May 13, 2022 · 3 comments
Open

Switch to esbuild? #7

hoodmane opened this issue May 13, 2022 · 3 comments

Comments

@hoodmane
Copy link

I got a basic build working with esbuild via:

  1. npm i esbuild
  2. Add the following build script as build.mjs
import esbuild from 'esbuild';
const { build } = esbuild;

build({
    entryPoints: ['lib/index.ts'],
    outdir: "dist",
    sourcemap: "linked",
}).catch(() => process.exit(1));
  1. run node build.mjs

This is advantageous because esbuild has 30x faster build times:

$ time npm run build > /dev/null

real	0m1.854s
user	0m2.890s
sys	    0m0.111s

$ time node build.mjs 

real	0m0.048s
user	0m0.032s
sys	    0m0.016s
@alexmojaki
Copy link
Owner

alexmojaki commented May 13, 2022

Sure. Never heard of esbuild before, and I wasn't bothered by a few seconds to build, but webpack clearly has issues and doing this in pyodide-worker-runner may be interesting. Just check that dist is the same before and after, and make a PR.

@alexmojaki
Copy link
Owner

I tried following these steps in pyodide-worker-runner. Issues I noticed:

  1. No .d.ts file
  2. No minification
  3. Need to handle uses of webpack raw-loader and worker-loader.

I'm sure these are all fixable, just pointing them out.

@hoodmane
Copy link
Author

Right the word "basic" is doing some work here, unfortunately I mean with some loss of functionality. Hopefully it's possible to get the functionality you need back but I think esbuild is not a fully general replacement for webpack.

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

No branches or pull requests

2 participants