Closed
Description
Module not found: Error: Can't resolve '~'
What is the current behavior?
Using a tilde ~
inside a css file causes Can't resolve '~'
if css-modules feature is activated:
{
loader: 'css-loader',
options: {
modules: true,
}
},
If the current behavior is a bug, please provide the steps to reproduce.
The bug can be reproduced this way: (https://github.com/jantimon/css-loader-bug)
git clone https://github.com/jantimon/css-loader-bug.git
cd css-loader-bug
npm install
npm run without-modules
npm run with-modules
Working webpack.config.js
Broken webpack.config.js
CSS File
What is the expected behavior?
Compilation should work even if modules
are set to true.
Motivation
I wrote a loader which adds ~!!
to a css file and it does not know if the user is using css-modules: https://github.com/jantimon/iconfont-webpack-plugin/blob/master/lib/postcss-plugin.js#L135-L137