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',
],
}),
}