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

Using ArcGIS API for JavaScript modules in a web worker causes "npm run build" to fail #15

Open
gavinr opened this issue Nov 9, 2021 · 0 comments

Comments

@gavinr
Copy link
Collaborator

gavinr commented Nov 9, 2021

Vite has a nice feature where you can add ?worker to an import and it will create a web worker. (see https://vitejs.dev/guide/features.html#web-workers)

When using a module from the ArcGIS API for JavaScript in the web worker, "npm run dev" works fine but "npm run build" (which, I think uses Rollup), fails with the error:

To preserve the export signature of the entry module "src\testWorker.ts", an empty facade chunk was created. This often happens when creating a bundle for a web app where chunks are placed in script tags and exports are ignored. In this case it is recommended to set "preserveEntrySignatures: false" to avoid this and reduce the number of chunks. Otherwise if this is intentional, set "preserveEntrySignatures: 'strict'" explicitly to silence this warning.
✓ 10 modules transformed.
[vite:worker] Invalid value "iife" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds.
file: C:/.../svelte-vite-web-workers-issue/src/testWorker.ts?worker
error during build:
Error: Invalid value "iife" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds.

Replication Steps:

  1. Clone this repo: https://github.com/gavinr/svelte-vite-web-workers-issue
  2. npm install
  3. npm run dev - notice it works fine
  4. npm run build - build fails, with the above error (expected: build should work)
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

1 participant