Skip to content

编译到小程序和 app-plus 时,.env 文件生效的 mode 有问题 #710

Closed
@jamieYou

Description

问题描述
使用这条命令时 cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch
发现默认的 mode 是 production
导致 .env.development 的配置没生效,而是匹配了 .env.production 的配置
小程序的话可以强行加上 --mode development 来解决
但是 app-plus 模式是 HBuilderX 来编辑的,我这边控制不了

预期结果
开发环境下,vue-cli mode 的默认值是 development

实际结果
小程序等开发环境下,vue-cli mode 的默认值是 production

Environment Info:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  Binaries:
    Node: 10.0.0 - ~/.nvm/versions/node/v10.0.0/bin/node
    Yarn: 1.12.3 - ~/.nvm/versions/node/v10.0.0/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v10.0.0/bin/npm
  Browsers:
    Chrome: 76.0.3809.100
    Firefox: Not Found
    Safari: 12.1.2
  npmPackages:
    @dcloudio/uni-app-plus: * => 0.0.252
    @dcloudio/uni-app-plus-nvue:  0.0.1
    @dcloudio/uni-app-plus-nvue-v8:  0.0.1
    @dcloudio/uni-cli-shared: * => 0.2.986
    @dcloudio/uni-h5: * => 0.9.0 (0.8.0)
    @dcloudio/uni-mp-weixin: * => 0.0.972
    @dcloudio/uni-stat:  0.0.111
    @dcloudio/uni-template-compiler: * => 0.9.181
    @dcloudio/vue-cli-plugin-hbuilderx: ^1.0.135 => 1.0.136
    @dcloudio/vue-cli-plugin-uni: ^0.9.524 => 0.9.525
    @dcloudio/vue-cli-plugin-uni-optimize: ^0.1.8 => 0.1.8
    @dcloudio/webpack-uni-mp-loader: * => 0.3.643
    @dcloudio/webpack-uni-nvue-loader:  0.0.1
    @dcloudio/webpack-uni-pages-loader: * => 0.2.871
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.0.0
    @vue/babel-preset-app:  3.10.0
    @vue/babel-preset-jsx:  1.1.0
    @vue/babel-sugar-functional-vue:  1.0.0
    @vue/babel-sugar-inject-h:  1.0.0
    @vue/babel-sugar-v-model:  1.0.0
    @vue/babel-sugar-v-on:  1.1.0
    @vue/cli-overlay:  3.11.0
    @vue/cli-plugin-babel: 3.5.1 => 3.5.1
    @vue/cli-plugin-eslint: ^3.5.0 => 3.11.0
    @vue/cli-service: ^3.10.0 => 3.11.0
    @vue/cli-shared-utils:  3.11.0
    @vue/component-compiler-utils:  3.0.0
    @vue/preload-webpack-plugin:  1.1.1
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.3
    mpvue-page-factory:  1.0.1
    mpvue-template-compiler:  1.0.13
    uni-h5-vue:  2.6.10
    uni-mp-vue:  2.6.10
    vue: ^2.6.10 => 2.6.10
    vue-class-component:  7.1.0
    vue-cli-plugin-style-resources-loader: ^0.1.3 => 0.1.3
    vue-eslint-parser:  5.0.0
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.1
    vue-property-decorator: ^8.1.1 => 8.2.1
    vue-router:  3.0.1
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.1.1 => 3.1.1
  npmGlobalPackages:
    @vue/cli: 3.5.3

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions