0
我正试图将在node_modules
目录中找到的所有CSS文件提取到一个文件中。我的WebPack配置如下:如何将所有CSS文件包含在由css-loader构建的node_modules中?
{ // node_modules css in /node_modules/**/*.css
test: /\.css$/,
include: /node_modules/,
// extract to the node modules css file
use: ExtractTextPluginNodeMods.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
modules: false,
},
},
],
}),
}
不幸的是,没有在node_modules
目录中的CSS文件正在捆绑与ExtractTextPluginNodeMods
指定的文件。我有另一个ExtractTextPlugin
实例成功地从我的src
目录中提取CSS。任何想法为什么我无法从node_modules
中提取CSS?
仅供参考,我的其他ExtractTextPlugin
/的WebPack配置(这是捆绑所有的我 CSS是在这里:
{
// OUR css in /src/
// the css output from sass loader will be caught here
// fonts are imported by css loader
// after transpiling of sass -> css, css-loader in webpack should take care of this
// https://github.com/webpack-contrib/css-loader
test: /\.css$/,
exclude: /node_modules/,
// extract to our css file
use: ExtractTextPluginSrc.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
// create modular css with the '[name]__[local]___[hash:base64:5]'
options: {
modules: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
},
},
'postcss-loader',
],
}),
}