Create React App 安装less 报错
发布时间:2020-12-15 09:33:47 所属栏目:百科 来源:网络整理
导读:执行npm run eject 暴露模块 ? 安装 npm i? less less-loader -D ? 1.打开 react app 的 webpack.config.js? const sassRegex = /.(scss|sass)$/; const sassModuleRegex = /.module.(scss|sass)$/; //添加 const lessRegex = /.less$/; const lessModul
执行npm run eject 暴露模块 ? 安装 npm i? less less-loader -D ? 1.打开 react app 的 webpack.config.js?
const sassRegex = /.(scss|sass)$/;
const sassModuleRegex = /.module.(scss|sass)$/;
//添加
const lessRegex = /.less$/;
const lessModuleRegex = /.module.less$/;
?
2. 在 大概467 行 添加?
{
test: lessRegex,
exclude: sassModuleRegex,
use: getStyleLoaders(
{
importLoaders: 2,
sourceMap: isEnvProduction && shouldUseSourceMap,
},
‘less-loader‘
),
// Don‘t consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
// Adds support for CSS Modules,but using SASS
// using the extension .module.scss or .module.sass
{
test: lessModuleRegex,
modules: true,
getLocalIdent: getCSSModuleLocalIdent,
# 必须在?file-loader 上面
?
?
这时 会发现 npm start 会报错?
?
删除 node_modules?
重新安装 npm instal
?
再npm tsatrt?
成功?
?
?
鼓掌
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- [SQLite3] ???? ?????? ?? (Backup of a Running Database)
- .net 将字典数据转换成xml 字符串, 以及传参至存储过程后如
- oracle 判断字段是否为是数字 regexp like用法 正则表达式
- visual-c – MFC MessageBox未显示在所有Windows的顶部
- cocos2dx 导演,场景,层,精灵模型
- ajax实现文件下载
- react native Webview ios <Error>: CGAffineTran
- oracle 利用url encode decode转换字符编码
- .net – 带命名空间的XML的XPath
- 如何用NSIS打包程序( 加载好依赖QT打包参考)