vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.76k stars 6.33k forks source link

打包时修改MODE后,项目解构不一致 #3545

Closed anyclub closed 5 years ago

anyclub commented 5 years ago

Version

3.4.1

Environment info

System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
  Binaries:
    Node: 8.11.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.7.0 - C:\Program Files\nodejs\yarn.CMD
    npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.1.0
  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-eslint: ^3.2.1 => 3.2.1
    @vue/cli-service: ^3.2.0 => 3.2.0
    @vue/cli-shared-utils:  3.2.0
    @vue/component-compiler-utils:  2.3.0
    @vue/eslint-config-standard: ^3.0.5 => 3.0.5
    @vue/preload-webpack-plugin:  1.1.0
    @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:  4.7.1
    vue: ^2.5.21 => 2.5.21 (2.5.21)
    vue-awesome-swiper: ^3.1.3 => 3.1.3
    vue-cli-plugin-style-resources-loader: ^0.1.3 => 0.1.3
    vue-cropper: ^0.4.7 => 0.4.7
    vue-eslint-parser:  2.0.3
    vue-hot-reload-api:  2.3.1
    vue-i18n: ^8.5.0 => 8.5.0
    vue-loader:  15.4.2
    vue-router: ^3.0.2 => 3.0.2
    vue-slicksort: ^0.1.10 => 0.1.10
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.5.21
    vue-template-es2015-compiler:  1.6.0
    vuex: ^3.0.1 => 3.0.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

用VUE-CLI创建一个项目后,使用"vue-cli-service build --mode mymode" 打包

After creating a project with VUE-CLI, package it with "vue-cli-service build --mode mymode"

What is expected?

项目结构与 vue-cli-service build 一致

Project structure is consistent with vue-cli-service build

What is actually happening?

结构不一致,JS文件全在INDEX.HTML同级目录下,且无HASH名称

Inconsistent structure, JS files are all in the same level of INDEX.HTML directory, and no HASH name

anyclub commented 5 years ago

这个项目根据测试环境,生产环境,正式环境;打包后的多处配置不一样

年前这样写都还是一样的结构,今天年后第一次发版就发现这问题了 如果我想快速回滚,请问是回滚哪个包到哪个版本呢

haoqunjiang commented 5 years ago

如果是用于打包,请在 .env 文件里加上 NODE_ENV=production

haoqunjiang commented 5 years ago

这个在我们英文文档里讲得比较明确,中文文档还没来得及翻译

When you are running vue-cli-service build, your NODE_ENV should always be set to "production" to obtain an app ready for deployment, regardless of the environment you're deploying to.

未来版本中考虑将这个限制做得更明显一些。