Open Menci opened 4 years ago
big lao, I found a way to fullfill this proposal, in https://github.com/facebook/create-react-app/issues/3660 like
addWebpackModuleRule({ test: /\.worker\.js$/, use: { loader: "worker-loader" }, }),
@caperso We should chain babel-loader
with worker-loader
to compile the scripts. So I created the rule based on the default .tsx
loader's rule.
The method to add web workers is a little complex. I finally figured out the way to chain the CRA's Babel loader and WebWorker loader:
https://github.com/syzoj/syzoj-ng-app/blob/7e8896bfd0205b8f815cca1333edeafa18d27d89/react-app-rewired.js#L88
Will my request be welcomed?