Multiple targets per-entry in Webpack 4

Viewed 502

Is it possible to define a different target per-entry, for both webpack and webpack-dev-server?

I tried following some guides which had different configurations passed to module.exports, but using webpack 4 it seems to not like getting an array (also - I'm not sure if this is really what I'd want, since it may conflict with webpack-dev-server).

Use-case is loading a wasm file in a web-worker, which is currently problematic, so I'd rather load the worker manually. However the worker is not only a shim for loading the wasm file, it also imports other js files and should be bundled via webpack.

Specifying only separate entries, without the target setting, doesn't seem to work either (I assume because bundles created this way assume the existence of document, window, etc.)

0 Answers
Related