当前位置:网站首页>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 !!!
边栏推荐
- 2.介绍部署LAMP平台+DISCUZ论坛
- 3. Believe you can understand! Circular statements and functions of shell scripts, arrays, bubble sorting
- Principle of struct2
- Strut2 form label
- 4. FTP service configuration and principle
- Fastdfs offline deployment (Graphic)
- 我为OpenHarmony 写代码,战“码”先锋第二期正式开启!
- 存储、计算、分布式计算篇(收集整理适合小白)
- CONDA configures the deep learning environment pytorch transformers
- 5. This simple "echo" usage, can the child next door!
猜你喜欢

5.NFS共享服务和ssh远程控制服务

使用Three.js实现炫酷的赛博朋克风格3D数字地球大屏

Ansible Deployment Guide

3. Believe you can understand! Circular statements and functions of shell scripts, arrays, bubble sorting

js 双向链表 02

5. This simple "echo" usage, can the child next door!

Number theory -- Research on divisor

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

Set up lnmp+discuz Forum

Angr(六)——angr_ctf
随机推荐
Deploy master-slave database
6. PXE combines kickstart principle and configuration to realize unattended automatic installation
Small knowledge of common classes
Angr (V) - angr_ ctf
9. Shell text processing three swordsmen awk
The ultimate summary of jsonobject parsing JSON format
二、unittest框架主要做什么
6.PXE结合Kickstart原理和配置实现无人值守自动装机
js 哈希表 02
Oh my Zsh and TMUX configuration (personal)
js 哈希表 01
Number theory --- the greatest common divisor and the least common multiple
Bug elements
Upgrade glibc 2.29 checking LD_ LIBRARY_ Path variable... Contains current directory error solution
Several common network diagnostic commands
6. Regular expression of shell
1.Shell编程规范与变量
2021 CEC笔试总结
Angr (VII) -- angr_ ctf
Pytorch calculates the loss for each sample in the batch