-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Version
4.5.9
Reproduction link
https://github.com/robinzimmermann/vue-build-issue-1
Environment info
Environment Info:
System:
OS: macOS 11.0.1
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 10.18.1 - ~/.nvm/versions/node/v10.18.1/bin/node
Yarn: Not Found
npm: 6.13.4 - ~/.nvm/versions/node/v10.18.1/bin/npm
Browsers:
Chrome: 87.0.4280.88
Edge: Not Found
Firefox: 82.0.3
Safari: 14.0.1
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.2.1
@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.2.1
@vue/babel-preset-app: 4.5.9
@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.9
@vue/cli-plugin-babel: ~4.5.0 => 4.5.9
@vue/cli-plugin-eslint: ~4.5.0 => 4.5.9
@vue/cli-plugin-router: ~4.5.0 => 4.5.9
@vue/cli-plugin-typescript: ~4.5.0 => 4.5.9
@vue/cli-plugin-unit-jest: ~4.5.0 => 4.5.9
@vue/cli-plugin-vuex: ~4.5.0 => 4.5.9
@vue/cli-service: ~4.5.0 => 4.5.9
@vue/cli-shared-utils: 4.5.9
@vue/compiler-core: 3.0.4
@vue/compiler-dom: 3.0.4
@vue/compiler-sfc: ^3.0.0 => 3.0.4
@vue/compiler-ssr: 3.0.4
@vue/component-compiler-utils: 3.2.0
@vue/eslint-config-prettier: ^6.0.0 => 6.0.0
@vue/eslint-config-typescript: ^5.0.2 => 5.1.0
@vue/preload-webpack-plugin: 1.1.2
@vue/reactivity: 3.0.4
@vue/runtime-core: 3.0.4
@vue/runtime-dom: 3.0.4
@vue/shared: 3.0.4
@vue/test-utils: ^2.0.0-0 => 2.0.0-beta.12
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^7.0.0-0 => 7.1.0
jest-serializer-vue: 2.0.2
typescript: ~3.9.3 => 3.9.7
vue: ^3.0.0 => 3.0.4
vue-eslint-parser: 7.2.0
vue-hot-reload-api: 2.3.4
vue-jest: ^5.0.0-0 => 5.0.0-alpha.7 (3.0.7)
vue-loader: 15.9.5 (16.1.0)
vue-router: ^4.0.0-0 => 4.0.0-rc.6
vue-style-loader: 4.1.2
vue-template-es2015-compiler: 1.9.1
vuex: ^4.0.0-0 => 4.0.0-rc.2
npmGlobalPackages:
@vue/cli: 4.5.9
Steps to reproduce
-
Check out the repo the reproduces: https://github.com/robinzimmermann/vue-build-issue-1
-
From the command line, build for production:
$ npm run build
The build fails, as expected.
-
Now immediately run the command again:
$ npm run build
The build succeeds, and no error is reported.
FYI That repo was just a basic creation using vue-cli with the following modifications:
-
Create a new project:
$ vue create hello-world
Here are the options I chose (from my
~/.vuerc
file):{ "useTaobaoRegistry": false, "presets": { "base-01": { "useConfigFiles": true, "plugins": { "@vue/cli-plugin-babel": {}, "@vue/cli-plugin-typescript": { "classComponent": false, "useTsWithBabel": true }, "@vue/cli-plugin-router": { "historyMode": true }, "@vue/cli-plugin-vuex": {}, "@vue/cli-plugin-eslint": { "config": "prettier", "lintOn": [ "save" ] }, "@vue/cli-plugin-unit-jest": {} }, "vueVersion": "3", "cssPreprocessor": "dart-sass" } } }
-
Edit
.eslintrc.js
, in therules
section, change:"no-console": process.env.NODE_ENV === "production" ? "warn" : "off"
to:
"no-console": process.env.NODE_ENV === "production" ? "error" : "off"
i.e. linting should error out if you have
console.log
in your app. -
Edit
src/main.ts
and add aconsole.log
statement:... console.log("Here we go!"); createApp(App) .use(store) .use(router) .mount("#app");
What is expected?
The second time the build is run, it should have failed.
The conditions are the same as the first run, and the console.log "error" is still present, so it should have failed.
What is actually happening?
The first time you run a build, it fails as expected.
But subsequent runs build, when they should fail.
NOTE: If you save src/main.js
and build again, then the build fails.
We need to be able to rely on the build failing if the project has errors.
If this is indeed a bug, and not a user error, then I would consider it a serious problem as it would be bad to successfully build when the project has errors.