Mini-css-extract-plugin: Is it possible to ignore urls (in CSS files only) ? (option url: false)

Created on 5 Dec 2018  路  6Comments  路  Source: webpack-contrib/mini-css-extract-plugin

Hi ! I'm trying to migrate from extract-text-webpack-plugin and I can't figure out if there is an option similar to url: false in mini-css-extract-plugin ?

Or any other way to ignore image urls in CSS files. (But not in JS files).

Many thanks in advance for any help or answer you can provide. 馃槂

Most helpful comment

hi @martinlemahieu , I'm having the same issue. so can you please mention your solution?

update: found it

[
  devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
    {
      loader: 'css-loader',
      options: { url: false }
    }
]

All 6 comments

Don't use this plugin for css, it is abandoned and deprecated

Sorry for my english, I'm trying to migrate FROM extract-text-webpack-plugin TO mini-css-extract-plugin.

I'm looking for a way not to process image files, in extract-text-webpack-plugin I was using {options: {url: false}}, is there a similar option in mini-css-extract-plugin ? Or any other solution to achieve this ?

@martinlemahieu it is option for css-loader, not for this plugin

@evilebottnawi it is ! 馃ぃ Sorry it seems I'm too tired, thank you for pointing it out, I could have spend some time figuring it out myself !

hi @martinlemahieu , I'm having the same issue. so can you please mention your solution?

update: found it

[
  devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
    {
      loader: 'css-loader',
      options: { url: false }
    }
]

Another example:

const MiniCssExtractPlugin = require('mini-css-extract-plugin');

// ...

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.s[ac]ss$/i,
        use: [
          MiniCssExtractPlugin.loader,
          { 
            loader: 'css-loader',
            options: {
              url: false
            }
          },
          'resolve-url-loader',
          'sass-loader'
        ]
      },
      // ...
    ]
  }
};
Was this page helpful?
0 / 5 - 0 ratings

Related issues

stavalfi picture stavalfi  路  4Comments

YanYuanFE picture YanYuanFE  路  3Comments

ripperdoc picture ripperdoc  路  3Comments

mike1808 picture mike1808  路  3Comments

TheHolyWaffle picture TheHolyWaffle  路  4Comments