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.config.js中配置postcss #3194

Closed
jzz4012650 opened this issue Dec 27, 2018 · 0 comments · Fixed by #3201
Closed

无法在vue.config.js中配置postcss #3194

jzz4012650 opened this issue Dec 27, 2018 · 0 comments · Fixed by #3201

Comments

@jzz4012650
Copy link
Contributor

Version

3.2.1

Environment info

  System:
    OS: macOS 10.14.2
    CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
  Binaries:
    Node: 9.11.2 - ~/.nvm/versions/node/v9.11.2/bin/node
    Yarn: 1.5.1 - /usr/local/bin/yarn
    npm: 6.5.0 - ~/.nvm/versions/node/v9.11.2/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 63.0.3
    Safari: 12.0.2
  npmPackages:
    @vue/babel-preset-app:  3.2.0
    @vue/cli-overlay:  3.2.0
    @vue/cli-plugin-babel: ^3.2.0 => 3.2.0
    @vue/cli-plugin-pwa: ^3.2.0 => 3.2.0
    @vue/cli-service: ^3.2.0 => 3.2.0
    @vue/cli-shared-utils:  3.2.0
    @vue/component-compiler-utils:  2.3.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/test-utils: ^1.0.0-beta.16 => 1.0.0-beta.26
    @vue/web-component-wrapper:  1.2.0
    babel-helper-vue-jsx-merge-props:  2.0.3
    babel-plugin-transform-vue-jsx:  4.0.1
    eslint-plugin-vue: ^5.0.0-0 => 5.0.0
    vue: ^2.5.21 => 2.5.21 (2.5.18)
    vue-eslint-parser:  4.0.3
    vue-hot-reload-api:  2.3.1
    vue-i18n: ^8.3.2 => 8.4.0
    vue-lazyload:  1.2.3
    vue-loader:  15.4.2
    vue-router: ^3.0.1 => 3.0.2
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.5.21
    vue-template-es2015-compiler:  1.6.0
    vue2-better-scroll: ^1.0.7 => 1.0.7
    vuex: ^3.0.1 => 3.0.1
  npmGlobalPackages:
    @vue/cli: 3.2.1

Steps to reproduce

  1. vue-cli 初始化一个项目
  2. 删除 package.json 中的 postcss 字段
  3. 按照官方文档( https://cli.vuejs.org/guide/css.html#postcss ),在 vue.config.js 中增加 postcss 相关的配置。
  4. postcss 的 autoprefix 没有按照预期生效

What is expected?

根据文档( https://cli.vuejs.org/guide/css.html#postcss )的描述,我应该可以在 vue.config.js 中配置 postcss 相关的配置

What is actually happening?

配置没有生效,追查代码发现判断逻辑有问题,只从 package.json 读取了 postcss 的配置
见:

const hasPostCSSConfig = !!(api.service.pkg.postcss || findExisting(api.resolve('.'), [

jzz4012650 added a commit to jzz4012650/vue-cli that referenced this issue Dec 27, 2018
修复 vue.config.js 中的 postcss 配置不生效
jzz4012650 pushed a commit to jzz4012650/vue-cli that referenced this issue Dec 27, 2018
@jzz4012650 jzz4012650 mentioned this issue Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants