Closed CL-nevins closed 2 years ago
我想在ice vite模式里开启postcss nested,使用npm init ice <project-name>创建项目,模板选择为TypeScript + FuSion Design,安装完依赖后,我参照官方配置文档,尝试在build.json里,添加postcssOptions配置:
postcss nested
npm init ice <project-name>
TypeScript + FuSion Design
build.json
postcssOptions
{ "vite": true, "plugins": [ [ "build-plugin-moment-locales", { "locales": ["zh-cn"] } ], [ "build-plugin-ignore-style", { "libraryName": "@alifd/next" } ] ], + "postcssOptions": { + "plugins": { + "postcss-preset-env": { + "browsers": ["last 2 versions"] + }, + "postcss-import": false, + "postcss-short": { "prefix": "x" } + }, + "syntax": "sugarss", + "parser": "sugarss", + "stringifier": "sugarss" + } }
运行npm start后,提示:
npm start
ERR! CONFIG Failed to get config. ERR! Cannot find module 'postcss-preset-env'
这是什么情况,postcss-preset-env不是内置了吗? 我将postcss-preset-env换成postcss-nested也是一样,提示未找到模块;
postcss-preset-env
postcss-nested
{ "vite": true, "plugins": [ [ "build-plugin-moment-locales", { "locales": ["zh-cn"] } ], [ "build-plugin-ignore-style", { "libraryName": "@alifd/next" } ] ], + "postcssOptions": { + "plugins": { + "postcss-nested": true + } + } }
vite 模式下默认没有内置任何 plugins,至于 postcss-preset-env require 不到是因为内置的 postcss 相关插件都已经经过预打包
了解了,安装了postcss-nested后设置生效了,谢谢
What is the current behavior? 发生了什么?
我想在ice vite模式里开启
postcss nested
,使用npm init ice <project-name>
创建项目,模板选择为TypeScript + FuSion Design
,安装完依赖后,我参照官方配置文档,尝试在build.json
里,添加postcssOptions
配置:运行
npm start
后,提示:这是什么情况,
postcss-preset-env
不是内置了吗? 我将postcss-preset-env
换成postcss-nested
也是一样,提示未找到模块;What is the expected behavior? 期望的结果是什么?
Any additional comments? 相关环境信息?