GoogleChromeLabs / worker-plugin

👩‍🏭 Adds native Web Worker bundling support to Webpack.
https://npm.im/worker-plugin
Apache License 2.0
1.91k stars 79 forks source link

Custom filename and chunkFilename support #82

Closed developit closed 4 years ago

developit commented 4 years ago

This adds support for specifying custom templates for filename and chunkFilename when instantiating WorkerPlugin in webpack.config.js:

new WorkerPlugin({
    filename: '[name].[hash:5].js',
    chunkFilename: '[name].[hash:5].js',
})

The config properties are also supported as loader parameters:

import Worker from "worker-plugin/loader?filename=foo.[hash:5].js!./worker";

This fixes #76.