8
votes

I want to force the webpack to enable specific plugin or loader for certain file/folder, multiply files. Is there a way?

1
Can you elaborate more with, for example, an example on what you mean with "specific plugin or loader for certain file/folders"? Note that in order to get great answers, you should look into how to write good questions.Juliën

1 Answers

11
votes

You can use "include" to only include a specific folder for this rule. For example (this code only compile .ts files in /app/src folder)

        {
            test: /\.ts$/,
            use: [
                { loader: 'react-hot-loader/webpack' },
                { loader: 'awesome-typescript-loader' }
            ],
            include: resolve(__dirname, './../app/src')
        },

More examples here: https://webpack.js.org/configuration/module/#condition