0.2.0 • Published 3 years ago

fork-loader v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

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.

0.2.0

3 years ago

0.1.1

5 years ago

0.1.0

6 years ago