vuejs / vue-cli

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

Example vue3+ts project, After build with const syntax #6747

Open wlx200510 opened 3 years ago

wlx200510 commented 3 years ago

Version

4.5.13

Environment info

System:
    OS: macOS 11.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 14.15.4 - ~/.nvm/versions/node/v14.15.4/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v14.15.4/bin/yarn
    npm: 6.12.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 94.0.4606.81
    Edge: Not Found
    Firefox: Not Found
    Safari: 14.0.2
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1
    @vue/babel-helper-vue-transform-on:  1.0.2
    @vue/babel-plugin-jsx:  1.1.0
    @vue/babel-plugin-transform-vue-jsx:  1.2.1
    @vue/babel-preset-app:  4.5.13
    @vue/babel-preset-jsx:  1.2.4
    @vue/babel-sugar-composition-api-inject-h:  1.2.1
    @vue/babel-sugar-composition-api-render-instance:  1.2.4
    @vue/babel-sugar-functional-vue:  1.2.2
    @vue/babel-sugar-inject-h:  1.2.2
    @vue/babel-sugar-v-model:  1.2.3
    @vue/babel-sugar-v-on:  1.2.3
    @vue/cli-overlay:  4.5.13
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.13
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.13
    @vue/cli-plugin-router: ~4.5.0 => 4.5.13
    @vue/cli-plugin-typescript: ~4.5.0 => 4.5.13
    @vue/cli-plugin-vuex: ~4.5.0 => 4.5.13
    @vue/cli-service: ~4.5.0 => 4.5.13
    @vue/cli-shared-utils:  4.5.13
    @vue/compiler-core:  3.2.20
    @vue/compiler-dom:  3.2.20
    @vue/compiler-sfc: ^3.2.10 => 3.2.20
    @vue/compiler-ssr:  3.2.20
    @vue/component-compiler-utils:  3.2.2
    @vue/devtools-api:  6.0.0-beta.19
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0
    @vue/eslint-config-typescript: ^7.0.0 => 7.0.0
    @vue/preload-webpack-plugin:  1.1.2
    @vue/reactivity:  3.2.20
    @vue/ref-transform:  3.2.20
    @vue/runtime-core:  3.2.20
    @vue/runtime-dom:  3.2.20
    @vue/server-renderer:  3.2.20
    @vue/shared:  3.2.20
    @vue/web-component-wrapper:  1.3.0
    eslint-plugin-vue: ^7.0.0 => 7.19.1
    typescript: 4.0.2 => 4.0.2
    vue: ^3.2.10 => 3.2.20
    vue-eslint-parser:  7.11.0
    vue-hot-reload-api:  2.3.4
    vue-loader:  15.9.8 (16.8.1)
    vue-router: ^4.0.0-0 => 4.0.11
    vue-style-loader:  4.1.3
    vue-template-es2015-compiler:  1.9.1
    vuex: ^4.0.0-0 => 4.0.2
  npmGlobalPackages:
    @vue/cli: 4.5.13

Steps to reproduce

  1. init a vue3 + ts project
  2. yarn build
  3. find const key words in dist
  4. just add transpileDependencies: [/\@vue/, /vue.runtime.esm-bundler.js/, /vue-/] in vue.config.js
  5. yarn build again
  6. find component after build still contains const will occur error in Android5

What is expected?

build with no const

What is actually happening?

const include in build things

wlx200510 commented 3 years ago

image It seems like this const keyword are used by loader? image that's my setting in vue.config.js, the vendor file has no const keywords anymore

screetBloom commented 3 years ago

It looks like your transpileDependencies are not configured to the corresponding npm packages you can provide a reproduction

wlx200510 commented 3 years ago

It looks like your transpileDependencies are not configured to the corresponding npm packages you can provide a reproduction

OK, I have a reproduction, will paste later,but I guess is not the transpileDependencies because I found the const is module code generate by webpack, not vendor dependencies.

wlx200510 commented 3 years ago

https://github.com/wlx200510/vue3-ts reproduction git