developit/workerize-loader

How to make the output worker js file under /static rather than root directory in Create React App?

sep2 opened this issue · 1 comments

sep2 commented

Create React App will bundle all the js files under a /static folder, which makes CDN cache easier, but the workerize-loader will output the hash.worker.js file under the root / path, how can I change that? Do I need to eject CRA?

You can set the name option:

import worker from 'workerize-loader?name=static/[hash]!./path-to-worker.js';