使用react-vite-antd,修改antd主题,报错 [vite] Internal server error: Inline JavaScript is not enabled. Is it set in your options? It is hacky way to make this function will be compiled preferentially by less
一般报错

在官方文档中,没有关于vite中如何使用自定义主题的相关配置,经过查阅
1.安装less yarn add less (已经安装了就不必再安装)
2.首先将App.css改成App.less,记得将app.ts(或者.tsx/.js)中的引入更改为 import "./App.less";
3.在App.less中,将原先引入的@import 'antd/dist/antd.css' 更改为 @import 'antd/dist/antd.less';
4.在vite.config.ts(.js)中进行修改
vite 2X
export default defineConfig({
css:{
preprocessorOptions:{
less:{
javascriptEnabled: true, //注意,这一句是在less对象中,写在外边不起作用
modifyVars:{ //在这里进行主题的修改,参考官方配置属性
'@primary-color': '#1DA57A',
},
}
}
},
})
vite 1X
export default{
cssPreprocessOptions:{
less:{
javascriptEnabled:true
}
}
}
然后刷新或者重启就好了
使用react-vite-antd,修改antd主题,报错 [vite] Internal server error: Inline JavaScript is not enabled. Is it set in your options? It is hacky way to make this function will be compiled preferentially by less的更多相关文章
- Ajax 报错 500 (Internal Server Error)
==========error======={"readyState":4,"responseText":"<html><head& ...
- CI当开启URL重写的时候,报错500 Internal Server Error
Internal Server Error The server encountered an internal error or misconfiguration and was unable to ...
- ivew定制主题 less ^3.0 时报错 .bezierEasingMixin(); Inline JavaScript is not enabled. Is it set in your options?
按照 ivew 提供的方法定制主题,创建一个 less 文件,在其中覆盖变量,再在 main.js 中引入.戳这里 出现报错: 问题貌似是在于 less 版本...两种解决方法: 1.打开项目pack ...
- kolla部署openstack allinone,报错APIError: 500 Server Error: Internal Server Error (\"oci runtime error: container_linux.go:235: starting container process caused \"container init exited prematurely
使用 kolla-ansible 部署 opnenstack:stein 执行 kolla-ansible -i ./all-in-one deploy 开始自动化部署 在部署过程中报错,报错信息如下 ...
- react、less、antd-mobile 报错Inline JavaScript is not enabled. Is it set in your options?
增加less-loader里面的配置.如图或者降级less到2.x版本
- Mysql 编译报错 g++: internal compiler error: Killed (program cc1plus) 解决办法
g++: internal compiler error: Killed (program cc1plus) 解决办法 g++: internal compiler error: Killed (pr ...
- 在React组件unmounted之后setState的报错处理
最近在做项目的时候遇到一个问题,在 react 组件 unmounted 之后 setState 会报错.我们先来看个例子, 重现一下问题: class Welcome extends Compone ...
- Mysql导入大文件报错(MySQL server has gone away(error 2006))
前言 我们在导入mysql数据时候,mysql客户端突然报错:MySQL server has gone away(error 2006) 类似这种情况,处理思路为:调节mysql允许导入包的大小即可 ...
- vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题
vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题 今天下载了一个开源项目一直运行不了,折腾了半天才找到问题所在,config ...
- Pytorch报错:cuda runtime error (59) : device-side assert triggered at /pytorch/aten/src/THC/generic/THCTensorMath.cu:26
Pytorch报错:cuda runtime error (59) : device-side assert triggered at /pytorch/aten/src/THC/generic/TH ...
随机推荐
- Mysql 非幂等性
幂等性就是指:一个幂等操作任其执行多次所产生的影响均与一次执行的影响相同. -- 幂等性在分布式高并发中很常见,如不能重复点赞.电商订单库存数要一致等. MySQL解决非幂等性常用方法: 1.乐观锁 ...
- Linux基础第三章:Linux软件安装及yum本地库创建
一.Linux软件安装 1.Rpm包安装 2.yum仓库安装 二.yum本地库建立 一.Linux软件安装软件安装共2种安装方式,通过rpm包安装或通过yum仓库库安装. 1.Rpm包安装rpm:Re ...
- 手动实现IOC
spring官方实现的ioc是通过反射和xml技术实现的,下面我们可以根据这个思路简单实现一下IOC,此处省略构建项目,项目的整体结构如图 第一步,在resources目录下创建beans.xml文件 ...
- 笛卡尔树 Cartesian tree
给个板子题 笛卡尔树是这样的一种数据结构:对于 \(n\) 个二元组 \((key, value)\) 形成的笛卡尔树,满足如下性质 其 \(key\) 值满足二叉搜索树性质 (中序排列单调递增),\ ...
- 保护IIS Web服务器安全的技巧
首先,开发一套安全策略 保护Web服务器的第一步是确保网络管理员清楚安全策略中的每一项制度.如果公司高层没有把服务器的安全看作是必须被保护的资产,那么保护工作是完全没有意义的.这项工作需要长期的努力. ...
- 快速了解 Kubernetes 的架构及特性
kubernetes 已经成为容器编排领域的王者,它是基于容器的集群编排引擎,具备扩展集群.滚动升级回滚.弹性伸缩.自动治愈.服务发现等多种特性能力.本文将带着大家快速了解 kubernetes ,了 ...
- 常用的js优秀框架个人记录
一.树框架 zTree http://www.treejs.cn/
- 深入理解snp-calling流程——转载
------------恢复内容开始------------ GATK4流程 准备配套数据 明确参考基因组版本!!!b36/b37/hg18/hg19/hg38,记住b37和hg19并不是完全一样的, ...
- vue父子组件,子组件调用父组件方法
问题描述:在table页面修改数据后,想刷新页面.修改页面以子组件的形式写的,现在想在子组件里面调用父组件的方法实现页面刷新! 将问题google后,以下两种方法都尝试过了,但是不起作用......大 ...
- ORA-01427: 单行子查询返回多个行 出现原因及对应防止措施
原因:没有做好子查询约束条件 解决方法:1.加 AND ROWNUM =1 条件 但筛选结果可能并非一定是你想要的 2.匹配查询唯一约束条件