javascript - 无法从节点模块包加载 css
问题描述
我正在尝试从节点模块包中导入 css。
import "packageName/dist/index.bundle.css";
我收到错误消息“当前没有配置加载程序来处理此文件。”
我正在使用 MiniCssExtractPlugin 并具有以下 web 包配置来加载 css -
const MiniCssExtractPlugin = new _MiniCssExtractPlugin({
filename: "[name].bundle.css",
chunkFilename: "[id].css",
});
AND
test: /\.css$/,
exclude: /node_modules/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: __dirname + "/../../public/css/",
},
},
{
loader: "css-loader",
options: {
importLoaders: 1,
modules: {
localIdentName: "[name]__[local]___[hash:base64:5]",
},
},
},
{
loader: "postcss-loader",
options: {
config: {
path: __dirname + "/postcss.config.js",
},
},
},
],
}
解决方案
推荐阅读
- python - BeautifulSoup 的查找函数返回包含特定搜索词的所有内容,而不仅仅是精确匹配
- java - Java - 签名算法的算法约束检查失败:RSASSA-PSS 尝试使用 SSLContext 打开 LDAP 连接
- c++ - c++中变量和指针的区别
- linux - Git 使用 cronjob 拉取服务器
- c++ - c++:每次打印向量时如何打印向量元素的索引?
- javascript - 不要去下一个然后承诺,直到前一个完成
- split - 如何形成 Splunk 查询以根据最大分区数将字段拆分为单独的字段?
- arrays - 附加不同的维度数组
- php - 使用 Ajax 自动完成在 select2 上选择的选项
- jquery - 无法在 KendoUI 上的 Treeview 上进行选择