I need to build a single js
that can be used as Service Worker.
I have a nrwl workspace with two @nrwl/web:lib
packages, one is common
and the other is worker
. The worker
package uses common
through import { stuff } from @my/common
.
With library
project type rollup
is used, however, the worker.umd.js
doesn't contain the common
dependency, so I need both common.umd.js
and worker.umd.js
and have to manually concat them before use as Service Worker.
With application
project type webpack
is used which bundles the common
dependency as well, but also generates other js files, such as vendor.js
, polyfills.js
etc. For this, I used @nrwl/angular
because with @nrwl/web:application
can't be made publishable.
Is there a better approach? Should I use some other nrwl plugin for this? I'd like to avoid angular
, react
if possible, but will use it if need be. Or should I just customize rollup
or webpack
config somehow? Or create my own plugin?