Skip to content

terser配置drop_console首次打包会触发eslint从而导致打包失败 #5908

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

Closed
KnorienChang opened this issue Sep 28, 2020 · 3 comments

Comments

@KnorienChang
Copy link

Version

4.5.6

Reproduction link

https://github.com/KnorienChang/vue-cli-bug-report-terser-drop-console

Environment info

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
  Binaries:
    Node: 12.18.4 - /usr/local/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.6 - /usr/local/bin/npm
  Browsers:
    Chrome: 85.0.4183.121
    Edge: 85.0.564.63
    Firefox: 81.0
    Safari: 14.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-helper-vue-transform-on:  1.0.0-rc.2
    @vue/babel-plugin-jsx:  1.0.0-rc.3
    @vue/babel-plugin-transform-vue-jsx:  1.1.2
    @vue/babel-preset-app:  4.5.6
    @vue/babel-preset-jsx:  1.1.2
    @vue/babel-sugar-functional-vue:  1.1.2
    @vue/babel-sugar-inject-h:  1.1.2
    @vue/babel-sugar-v-model:  1.1.2
    @vue/babel-sugar-v-on:  1.1.2
    @vue/cli-overlay:  4.5.6
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.6
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.6
    @vue/cli-plugin-router: ~4.5.0 => 4.5.6
    @vue/cli-plugin-vuex: ~4.5.0 => 4.5.6
    @vue/cli-service: ~4.5.0 => 4.5.6
    @vue/cli-shared-utils:  4.5.6
    @vue/component-compiler-utils:  3.2.0
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0
    @vue/preload-webpack-plugin:  1.1.2
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^6.2.2 => 6.2.2
    vue: ^2.6.11 => 2.6.12
    vue-eslint-parser:  7.1.0
    vue-hot-reload-api:  2.3.4
    vue-loader:  15.9.3 (16.0.0-beta.8)
    vue-router: ^3.2.0 => 3.4.5
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.11 => 2.6.12
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.4.0 => 3.5.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

1、git clone [email protected]:KnorienChang/vue-cli-bug-report-terser-drop-console.git

2、cd vue-cli-bug-report-terser-drop-console

3、npm i

4、npm run build

What is expected?

terser配置drop_console能够正常去除console,并且不会触发eslint从而导致打包失败的问题

What is actually happening?

打包失败

@haoqunjiang
Copy link
Member

触发 ESLint 是合理的。修改 ESLint 默认配置就好了。
https://github.com/KnorienChang/vue-cli-bug-report-terser-drop-console/blob/master/.eslintrc.js#L11-L12

@KnorienChang
Copy link
Author

触发 ESLint 是合理的。修改 ESLint 默认配置就好了。
https://github.com/KnorienChang/vue-cli-bug-report-terser-drop-console/blob/master/.eslintrc.js#L11-L12

触发eslint肯定是合理的,第一次打包的时候会失败,在不修改代码的情况下直接打包第二次就能通过了,现在的期望是在不修改eslint配置的情况下,第一次打包的时候也能通过。

@haoqunjiang
Copy link
Member

第二次能过是 bug,见 #3065 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants