Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-cli + vue2 + vant2 + postcss-px-to-viewport 不生效 #13

Open
sizhuxuan opened this issue Sep 19, 2023 · 6 comments
Open

vue-cli + vue2 + vant2 + postcss-px-to-viewport 不生效 #13

sizhuxuan opened this issue Sep 19, 2023 · 6 comments

Comments

@sizhuxuan
Copy link

我前段时间使用vite + vue3 + vant4 + postcss-px-to-viewport 根据example-with-postcss-px-to-viewport-vue中的配置,是生效的。这个有一个老的vue2项目,我根据example都试了一编,都没生效,不知道怎么回事

@wswmsword
Copy link
Owner

你安装的 mobile-forever 版本号是多少,example 里用的 mobile-forever 是 2.4.1

@wswmsword
Copy link
Owner

方便的话可以把 postcss 配置和 package.json 版本号情况发给我参考一下

@wswmsword
Copy link
Owner

如果安装的 4.0 的 mobile-forever 的话,配置要更新,有些属性名称变了,我更新了一下 example-with-postcss-px-to-viewport-vue,原来这个范例用的版本是 2.4.1,现在更新成最新的 4.0 了。

@mq931001
Copy link

mq931001 commented Apr 7, 2024

"postcss": "^8.4.38",
postcss-px-to-viewport": "^1.1.1",
"postcss-mobile-forever": "^4.1.2",
"vue": "^2.6.11",

我这安装完 就报Syntax Error: Error: PostCSS plugin postcss-mobile-forever requires PostCSS 8.
Migration guide for end-users: 这个错误

@wswmsword
Copy link
Owner

@mq931001 你好,可能是因为老版本的 Vue 项目依赖的 PostCSS 不是最新的版本,您试下这个应该可以:

npm install postcss-mobile-forever@legacy --save-dev

这个版本的 mobile-forever 依赖老版本的 PostCSS。

@mq931001
Copy link

mq931001 commented Apr 8, 2024

可以了 成功了 谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants