Skip to content
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

vue.config.js failing calls to require() are now ignored #5442

Closed
mrozekma opened this issue May 2, 2020 · 0 comments · Fixed by #5500
Closed

vue.config.js failing calls to require() are now ignored #5442

mrozekma opened this issue May 2, 2020 · 0 comments · Fixed by #5500

Comments

@mrozekma
Copy link

mrozekma commented May 2, 2020

Version

4.3.0

Reproduction link

https://github.com/mrozekma/vue-cli-bug-demo

Environment info

Environment Info:

  System:
    OS: Linux 4.19 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (4) x64 06/8e
  Binaries:
    Node: 12.10.0 - /usr/bin/node
    Yarn: 1.19.1 - /usr/bin/yarn
    npm: 6.10.3 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 68.7.0esr
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.1.2 
    @vue/babel-preset-app:  4.3.1 
    @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.3.1 
    @vue/cli-plugin-babel: ^4.3.0 => 4.3.1 
    @vue/cli-plugin-router: ^4.3.0 => 4.3.1 
    @vue/cli-plugin-typescript: ^4.3.0 => 4.3.1 
    @vue/cli-plugin-vuex:  4.3.1 
    @vue/cli-service: ^4.3.0 => 4.3.1 
    @vue/cli-shared-utils:  4.3.1 
    @vue/component-compiler-utils:  3.1.2 
    @vue/preload-webpack-plugin:  1.1.1 
    @vue/web-component-wrapper:  1.2.0 
    typescript: ~3.8.3 => 3.8.3 
    vue: ^2.6.11 => 2.6.11 
    vue-hot-reload-api:  2.3.4 
    vue-loader:  15.9.2 
    vue-router: ^3.1.6 => 3.1.6 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.11 => 2.6.11 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: 4.2.2

Steps to reproduce

Run yarn serve. It will load successfully. Then downgrade to @vue/cli-service@4.2.3 and yarn serve will correctly fail.

What is expected?

ERROR Error loading vue.config.js:
ERROR Error: Cannot find module 'bad-module'

What is actually happening?

Server loads successfully


Commit f1bdf73 simplified vue.config.js loading by not checking if the file exists, but instead just require()-ing it and catching the failure if it doesn't. However, this also suppresses cases where vue.config.js exists, but it in turn calls require() on something that doesn't exist, since all the exception handling code looks for is e.code === 'MODULE_NOT_FOUND'

@sodatea sodatea added the bug label May 2, 2020
sodatea added a commit to sodatea/vue-cli that referenced this issue May 19, 2020
reverts vuejs#5305
this makes the tests a little more tedious, need to find a better way
to test these functionalities

fixes vuejs#5442
sodatea added a commit that referenced this issue May 19, 2020
…5500)

reverts #5305
this makes the tests a little more tedious, need to find a better way
to test these functionalities

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

Successfully merging a pull request may close this issue.

2 participants