Skip to content
Discussion options

You must be logged in to vote

@rishabhjain9191 Try this:

const path = require("path");
const webpack = require("webpack");

let myWorkerURL = "dist/[fullhash]/my-worker/worker.mjs";

module.exports = [
  {
    mode: "development",
    devtool: false,
    name: "my-worker",
    entry: "./worker.js",
    target: ["webworker", "es2020"],
    experiments: { outputModule: true },
    output: {
      module: true,
      filename: "worker.mjs",
      path: path.resolve(__dirname, path.dirname(myWorkerURL)),
    },
    plugins: [
      {
        apply: (compiler) => {
          compiler.hooks.done.tap("MyPlugin", (stats) => {
            myWorkerURL = myWorkerURL.replace(/\[fullhash]/, stats.hash);
          });
        }
      

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@rishabhjain9191
Comment options

@alexander-akait
Comment options

Answer selected by rishabhjain9191
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants