My project is dependent on a package called my-package and it has one directory with global css and all others css-modules enabled, how to configure the loader?
The file structure like this.
webpack.config.js
node_modules
鈹斺攢my-package
鈹斺攢 src
鈹溾攢styles (css should be global here)
鈹溾攢 Component1 (css should be local here)
鈹溾攢 Component2
鈹溾攢 Component3
I want to make all styles in src/styles global while others with css-modules. I try to config like this:
loaders: [{
test: /\.scss$/,
include: fs.realpathSync('./node_modules/my-package/src')
exclude: fs.realpathSync('./node_modules/my-package/src/styles')
loader: cssModulesLoader,
}, {
test: /\.scss$/,
include: fs.realpathSync('./node_modules/my-package/src/styles')
loader: globalCssLoader
}]
What I want is include all the directory first and exclude one sub-directory, but the include and exclude does not work, how to configure for this, thanks.
Closed as include and exclude works as expected actually.
hey @camsong - trying to get a similar situation working locally. Any way you can provide a gist of your solution?
My code above works right. it will include all subdirectory except for styles
include: fs.realpathSync('./node_modules/my-package/src')
exclude: fs.realpathSync('./node_modules/my-package/src/styles')
Most helpful comment
My code above works right. it will include all subdirectory except for
styles