google / playground-elements

Serverless coding environments for the web.
BSD 3-Clause "New" or "Revised" License
535 stars 53 forks source link

esbuild configuration: webworker support #335

Open timbomckay opened 2 years ago

timbomckay commented 2 years ago

I'm trying to get an 11ty with esbuild structure setup to use playground-elements in a component-library monorepo and am struggling to get esbuild to work.

I get the "Failed to construct 'URL'" error and struggled to figure this out for a couple hours until I finally found the Bundling documentation where it calls out the file in question within the Other section. I updated my esbuild config to include the file in question via:

config.addPassthroughCopy({ "node_modules/playground-elements/playground-typescript-worker.js": "playground-typescript-worker.js" })

It's in the same directory as my main.js file but I'm still getting the error.

When I noticed that webpack 5 has worker support builtin I thought I'd check esbuild and found this web worker issue. I don't see any resolution in there and not sure if there's something else I should be doing or if esbuild isn't compatible at this time.

If anyone has any advice it'd be greatly appreciated.

Thanks