0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

webpackの設定で同じtestディレクトリー別に違うrulesを適用する

Posted at
// webpack.config.js
module.exports = {
    ...
    module: {
        rules: [
      {
        test: ...,
        oneOf: [
          {
            include: path.resolve(__dirname, ルールを適用したいディレクトリーのパス),
            use: ... // ここのloaderはincludeのパスのみに適用される
          },
          {
            exclude: path.resolve(__dirname, ルールを適用したくないディレクトリーのパス),
            use: ... // ここのloaderはexcludeのパス以外すべてに適用される
          },
          ...
        ],
      }
    ]
}

oneOfでグループ化して別々の複数のルールを同じ種類のファイルに適用することができる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?