[Proposal] Add "publicPath" and "name" options
xzilja opened this issue · 4 comments
I am using workerize-loader
in next.js project and as far as I know only option to use it there is to set inline: true
. Which works ok, but grows my main commons.js
file quiet a bit if there are several workers involved.
Uppon looking at https://github.com/zeit/next-plugins/blob/master/packages/next-workers/index.js which is next.js official plugin for workers I saw that they use worker-loader
and set name
and publicPath
options so that worker file is exported under static folder.
Is it possible to add these same options to workerize-loader
in order to disable inline
blob and rather export it to a separate file?
Closing this as PR that adds publicPath was approved and it seems that name
field already works somehow?
i.e. I got next.js working with following config:
{
test: /\.worker\.ts$/u,
use: [
{
loader: 'workerize-loader',
options: {
name: 'static/[hash].worker.js',
publicPath: '/_next/'
}
},
}
Closing this as PR that adds publicPath was approved and it seems that
name
field already works somehow?i.e. I got next.js working with following config:
{ test: /\.worker\.ts$/u, use: [ { loader: 'workerize-loader', options: { name: 'static/[hash].worker.js', publicPath: '/_next/' } }, }
Hi @iljadaderko, I use next.js 9.2.0 and also the workerize-loader,but caught an error: ReferenceError: Worker is not defined
do you have any idea how to solve it ? or what's your next.config.js ?