How to disable css modules for one file in webpack

I need to disable css modules for only one file.

Please explain how I can do this

I have two web files

Please help me configure my files webpack.config.dev.js

and webpack.config.prod.js

.

I installed css modules with the tutorial https://medium.com/nulogy/how-to-use-css-modules-with-create-react-app-9e44bec2b5c2 .

My webpack config is below:

DEV

 test: /\.css$/,
        use: [
          require.resolve('style-loader'),
          {
            loader: require.resolve('css-loader'),
            options: {
              importLoaders: 1,
              modules: true,
              localIdentName: "[name]__[local]___[hash:base64:5]"
            },
          },
      

Run codeHide result


prod

test: /\.css$/,
        loader: ExtractTextPlugin.extract(
          Object.assign(
            {
              fallback: require.resolve('style-loader'),
              use: [
                {
                  loader: require.resolve('css-loader'),
                  options: {
                    importLoaders: 1,
                    modules: true,
                    minimize: true,
                    sourceMap: true,
                  },
                },
      

Run codeHide result


the path for my file is "response-infin-calendar / styles.css".

How do I add an exception?

Thank you in advance!

+3


source to share


1 answer


Use the parameter exclude

:



// ...
test: /\.css$/,
exclude: /yor_file\.css$/,
// ...

      

+3


source







All Articles