bencodezen / vue-enterprise-boilerplate

An ever-evolving, very opinionated architecture and dev environment for new Vue SPA projects using Vue CLI.
7.77k stars 1.32k forks source link

Build will fail when adding certain aliases #97

Closed pingren closed 5 years ago

pingren commented 5 years ago

In aliases.config.js, adding new alias like '@api': 'src/api' to const aliases, and then run

yarn build

Compiler will warn

β ™  Building modern bundle for production...

 WARNING  Compiled with 4 warnings                                                                                                                                    

 warning  in ./src/app.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

 warning  in ./src/app.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

 warning  in ./src/router/views/home.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

 warning  in ./src/router/views/login.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

the app.config' is not found and in the browser the home page will be blank.

FYI:

chrisvfritz commented 5 years ago

I'm not able to reproduce this, unfortunately, but it sounds similar to some issues with case-insensitive file systems. Is it possible you committed with a folder name like src/Api, then renamed to src/api?

Also, if you try to reproduce with a fresh clone, do you still get the issue?

pingren commented 5 years ago

To make sure the issue is not caused by my modification to the repo. I checked out to 8c4673448 and tested with only modifyingaliases.config.js before I created the issue.

And just now, I git cloned the latest(75c498ad) fresh repo , do the edit, and run yarn & yarn build, however the issue still exist.

I am on MacOS High Sierra with APFS file system, which is case-insensitive.

chrisvfritz commented 5 years ago

Very strange. πŸ˜• Would you mind pushing your minimal reproduction to a public repo so I can make sure I'm testing with the same code?

pingren commented 5 years ago

I just found out the issue might be related to run yarn in VSCode integrated terminal because yarn build actually fails with a fresh clone. It is very strange I bypassed the issue on my end and another Windows10 by tweaking aliases. It mislead me to submit the original issue.

minimal reproduction

in a external terminal (iTerm2)

Last login: Thu Oct 11 17:26:26 on ttys004
Pings-Hackintosh:~ hackintosh$ cd Downloads/
Pings-Hackintosh:Downloads hackintosh$ git clone https://github.com/chrisvfritz/vue-enterprise-boilerplate
Cloning into 'vue-enterprise-boilerplate'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 1288 (delta 4), reused 13 (delta 2), pack-reused 1267
Receiving objects: 100% (1288/1288), 748.77 KiB | 735.00 KiB/s, done.
Resolving deltas: 100% (709/709), done.
Pings-Hackintosh:Downloads hackintosh$ code-insiders vue-enterprise-boilerplate

in the VSCode integrated terminal

Pings-Hackintosh:vue-enterprise-boilerplate hackintosh$ yarn
yarn install v1.10.1
[1/5] πŸ”  Validating package.json...
[2/5] πŸ”  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] πŸ”—  Linking dependencies...
warning "@vue/cli-plugin-babel > babel-loader@8.0.4" has incorrect peer dependency "@babel/core@^7.0.0".
warning "@vue/cli-plugin-babel > babel-loader@8.0.4" has unmet peer dependency "webpack@>=2".
warning "@vue/cli-plugin-e2e-cypress > eslint-plugin-cypress@2.0.1" has unmet peer dependency "eslint@>= 3.2.1".
warning "@vue/cli-plugin-eslint > eslint-loader@2.1.1" has unmet peer dependency "webpack@>=2.0.0 <5.0.0".
warning "@vue/eslint-config-prettier > eslint-config-prettier@2.10.0" has unmet peer dependency "eslint@>=3.14.1".
warning "@vue/eslint-config-standard > eslint-plugin-standard@3.1.0" has unmet peer dependency "eslint@>=3.19.0".
warning "@vue/eslint-config-standard > eslint-plugin-node@6.0.1" has unmet peer dependency "eslint@>=3.1.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has unmet peer dependency "eslint@>=5.0.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has incorrect peer dependency "eslint-plugin-node@>=7.0.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has incorrect peer dependency "eslint-plugin-promise@>=4.0.0".
warning "@vue/eslint-config-standard > eslint-config-standard@12.0.0" has incorrect peer dependency "eslint-plugin-standard@>=4.0.0".
warning "@vue/eslint-config-standard > eslint-plugin-import@2.14.0" has unmet peer dependency "eslint@2.x - 5.x".
warning " > babel-core@7.0.0-bridge.0" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > eslint-plugin-vue@5.0.0-beta.3" has unmet peer dependency "eslint@^5.0.0".
warning "eslint-plugin-vue > vue-eslint-parser@3.2.2" has unmet peer dependency "eslint@^5.0.0".
warning " > sass-loader@7.1.0" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
[5/5] πŸ“ƒ  Building fresh packages...
success Saved lockfile.
✨  Done in 178.66s.
Pings-Hackintosh:vue-enterprise-boilerplate hackintosh$ yarn build
yarn run v1.10.1
$ vue-cli-service build --modern

β ‡  Building legacy bundle for production...

 DONE  Compiled successfully in 8895ms                                                                                                                                δΈ‹εˆ5:42:01

  File                                      Size             Gzipped

  dist/js/chunk-vendors-legacy.09cd4a9c.    196.16 kb        67.67 kb
  js
  dist/js/app-legacy.2c81f1c4.js            16.95 kb         5.50 kb
  dist/js/chunk-73c370d8-legacy.a878b3a7    1.78 kb          0.89 kb
  .js
  dist/js/chunk-2d0ae528-legacy.a233fecc    0.73 kb          0.48 kb
  .js
  dist/js/chunk-42e69ba1-legacy.16a0ecf7    0.65 kb          0.46 kb
  .js
  dist/css/app.ac3073c5.css                 4.47 kb          1.04 kb
  dist/css/chunk-vendors.46b027e5.css       3.08 kb          1.11 kb
  dist/css/chunk-73c370d8.d81e1ffd.css      0.09 kb          0.11 kb

  Images and other types of assets omitted.

β ¦  Building modern bundle for production...

 WARNING  Compiled with 4 warnings                                                                                                                                    δΈ‹εˆ5:42:08

 warning  in ./src/app.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

 warning  in ./src/app.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

 warning  in ./src/router/views/home.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

 warning  in ./src/router/views/login.vue?vue&type=script&lang=js&

"export 'default' (imported as 'appConfig') was not found in '@src/app.config'

  File                                    Size              Gzipped

  dist/js/chunk-vendors.2198fee7.js       196.49 kb         67.74 kb
  dist/js/app.c76ffd35.js                 17.00 kb          5.50 kb
  dist/js/chunk-73c370d8.c1e44bd7.js      1.78 kb           0.89 kb
  dist/js/chunk-2d0ae528.93950952.js      0.73 kb           0.48 kb
  dist/js/chunk-42e69ba1.8a1c1115.js      0.63 kb           0.44 kb
  dist/css/app.ac3073c5.css               4.47 kb           1.04 kb
  dist/css/chunk-vendors.46b027e5.css     3.08 kb           1.11 kb
  dist/css/chunk-73c370d8.d81e1ffd.css    0.09 kb           0.11 kb

  Images and other types of assets omitted.

 DONE  Build complete. The dist directory is ready to be deployed.
 INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

✨  Done in 18.66s.
Pings-Hackintosh:vue-enterprise-boilerplate hackintosh$

new fix

in the VSCode integrated terminal

in a external terminal (iTerm2)

I fixed a fresh clone and my modified project with above method.

I would like to push it to a public repo if it helps you figure out the issue. But since there is no modification is it still necessary?

chrisvfritz commented 5 years ago

No, not necessary if it even happens with a fresh clone with no modifications. πŸ™‚ Thanks for the added information. Now what's really weird is that I primarily use the VS Code integrated terminal, also on macOS, but have never seen these issues. πŸ˜…

pingren commented 5 years ago

Another educated guess is that it is caused by unstable Internet connection to npm registry on my geo location 🀣, though I didn't see any error messages in the terminal.

As far as this issue was fixed, I could live without knowing the cause. Thank you.

chrisvfritz commented 5 years ago

Ha, glad it's working now! Whatever it was, I hope you never see it again. πŸ˜„