当前位置:网站首页>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 !!!
边栏推荐
- Use of mongodb
- Multithreading - runnable interface, tortoise and rabbit race
- Angr(三)——angr_ctf
- Angr (IX) -- angr_ ctf
- 3.信你能理解的!shell脚本之循环语句与函数,数组,冒泡排序
- After switching the shell command line terminal (bash/zsh), CONDA cannot be used: command not found
- 5. This simple "echo" usage, can the child next door!
- 8.shell文件处理三剑客之sed
- Ansible Deployment Guide
- 3.跟你思想一样DNS域名解析服务!!!
猜你喜欢

Angr (IV) -- angr_ ctf

我为OpenHarmony 写代码,战“码”先锋第二期正式开启!

Idea overall font size modification

JS hash table 02

Upgrade glibc 2.29 checking LD_ LIBRARY_ Path variable... Contains current directory error solution

2021 Niuke written examination summary 02

存储、计算、分布式存储篇(收集整理适合小白)

Configuration of static routes (take Huawei ENSP as an example)

11. Iptables firewall

4. FTP service configuration and principle
随机推荐
平凡人的一生的意义是什么?
Basic concepts of testing
我为OpenHarmony 写代码,战“码”先锋第二期正式开启!
9. Shell text processing three swordsmen awk
测试计划、测试方案
微信小程序WxPrase中包含文件无法点击解决
Angr(九)——angr_ctf
虚拟专线网络部署
Snake games
js 集合
String longest common prefix
Angr (x) - official document (Part1)
Wechat applet wxprase contains files that cannot be solved by clicking
Deadlock event of thread pool
Angr(四)——angr_ctf
2021 去哪儿网笔试总结
Strut2 form label
Angr (IX) -- angr_ ctf
Radio and multi selection buttons of swing components
Differences between redis and mongodb