Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
/ fork-loader Public archive

Webpack loader to fork input source into multiple downstreams

License

Notifications You must be signed in to change notification settings

occar421/fork-loader

Repository files navigation

fork-loader

CircleCI npm version license

Webpack loader to fork input source into multiple down streams.

How to use

      {
        test: /\.html$/,
        rules: [
          // Do not add config here!
          {
            resourceQuery: /fork-tag=foo/, // specified this name by option "marker" of ./loader.js
            oneOf: [
              {
                resourceQuery: /fork-id=a/,
                loader: "noop-loader" // your loaders & configs
              },
              {
                resourceQuery: /fork-id=b/,
                loader: "noop-loader" // your other loaders & configs
              },
            ]
          },
          {
            loader: "fork-loader",
            options: {
              tag: 'foo',
              ids: ["a", "b"]
            },
          }
        ]
      }

In that config, "hoge.html" becomes both "hoge.html?tag=foo&id=a" & "hoge.html?tag=foo&id=b" and we can pass other loaders respectively.
If you want to nest it, see nestedCompiler in "./test/compiler.js".

Maybe this is similar with multi-loader.

About

Webpack loader to fork input source into multiple downstreams

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published