当前位置:网站首页>Using px2rem does not take effect
Using px2rem does not take effect
2022-07-25 10:35:00 【PBitW】
Rookie recently did a project , Just need to use px2rem, But all the online searches are problematic , Maybe the rookie is too delicious , Still looking at the wrong place , The boss can give advice !!!
Every time a rookie wants readers to exchange ideas , But there is no one in the pinlun area every time ,(T~T)
List of articles
webpack To configure
First, the first pit is vue.config.js, Many bloggers say that the configuration is like this :
But the rookie actually said it would report an error , Report the wrong thing :
ERROR Failed to compile with 1 error 17:18:34
error in ./src/views/HomeView.vue?vue&type=style&index=0&id=9ea40744&scoped=true&lang=css&
Syntax Error: ValidationError: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'plugins'. These properties are valid:
object { postcssOptions?, execute?, sourceMap?, implementation? }
ERROR in ./src/views/HomeView.vue?vue&type=style&index=0&id=9ea40744&scoped=true&lang=css& (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/@vue/cli-service/node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/HomeView.vue?vue&type=style&index=0&id=9ea40744&scoped=true
Anyway, I don't know how to solve it !!!( I hope readers can communicate more )
Correct configuration , Compatible with current vuecli
(vue3 I don't know whether the branch supports it )
module.exports = {
chainWebpack: config => {
config.module
.rule("css")
.test(/\.css$/)
.oneOf("vue")
.resourceQuery(/\?vue/)
.use("px2rem-loader")
.loader("px2rem-loader")
.before('postcss-loader')
.options({
remUnit: 75
});
},
}
The created template contains defineConfig The same is true for copying the past , Compatible !
Downloaded package
See other bloggers , Some installation packages don't say , What you said is incomplete , Here the rookie lists all the things he needs
- npm i px2rem-loader -D
- npm i postcss-loader -D
- npm i postcss-px2rem -D
Use of
This postcss-px2rem It's not compatible scss Of , Anyway, as long as the rookie is style Add up lang=‘scss’, This will directly fail !!!
Online search methods are also more and more unreliable , It is recommended not to use scss 了 , Anyway, it doesn't really affect !!!
Remember briefly , In the future, it's easy to use by yourself !!!
边栏推荐
- Snake games
- 1.Shell编程规范与变量
- 存储、计算、分布式虚拟化篇(收集整理适合小白)
- Bug elements
- Angr(十)——官方文档(Part1)
- Modify MySQL group error expression 1 of select list is not in group
- shortest-unsorted-continuous-subarray
- Angr(五)——angr_ctf
- Detailed explanation of chrome developer tools
- CONDA configures the deep learning environment pytorch transformers
猜你喜欢
随机推荐
Research summary of voice self-monitoring pre training model CNN encoder
Supervisor deployment (offline deployment requires downloading the deployment package in advance)
一、unittest框架和pytest框架的区别
Supervisor部署(离线部署需要提前下载部署包)
for循环:水仙花案例
Detailed explanation of chrome developer tools
Pytorch calculates the loss for each sample in the batch
Attention is all you need paper intensive reading notes transformer
Differences between redis and mongodb
Bug classification and grading
Set up lnmp+discuz Forum
Oh my Zsh and TMUX configuration (personal)
Configuration of static routes (take Huawei ENSP as an example)
Wechat applet wxprase contains files that cannot be solved by clicking
2021 牛客网笔试总结 02
3.信你能理解的!shell脚本之循环语句与函数,数组,冒泡排序
Pytoch separates tensor by the value of one dimension of tensor (simple)
3、 Five operation modes of unittest test cases
TCP transmission
Software test notes, test case design








