quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.77k stars 3.5k forks source link

Setting quasar.config.js > build > sourcemap to `true` can't create a separate sourcemap file. #14589

Open dongwa opened 1 year ago

dongwa commented 1 year ago

What happened?

I want to test the configuration item of SourceMap. I found that when I set quasar.config.js > build > sourcemap to true, there was no separate sourcemap file in the dist/spa folder as described in the document:

If true, a separate sourcemap file will be created.

image

image

What did you expect to happen?

I don't know whether this is a document description error or quasar CLI behavior mistake, I think they should be consistent

Reproduction URL

https://stackblitz.com/edit/quasarframework-bdqfmg?file=dist/spa/assets/ErrorNotFound.ff16392e.js

How to reproduce?

  1. Using Quasar CLI with vite to create a project
  2. set quasar.config.js > build > sourcemap: true
  3. run quasar build
  4. see files in dist/spa/assets,There is no separate documents mentioned in the map file

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)

Platforms/Browsers

Chrome, Microsoft Edge

Quasar info output

Operating System - Linux(5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.37) - linux/x64
NodeJs - 16.14.2

Global packages
  NPM - 7.17.0
  yarn - 1.22.10
  @quasar/cli - undefined
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.9.2 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 1.1.2 -- Quasar Framework App CLI with Vite
  @quasar/extras - 1.15.4 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.2.40 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.1.5
  pinia - Not installed
  vuex - Not installed
  vite - 2.9.15 -- Native-ESM powered web dev build tool
  eslint - 8.24.0 -- An AST-based pattern checker for JavaScript.
  electron - Not installed
  electron-packager - Not installed
  electron-builder - Not installed
  register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  *None installed*

Networking
  Host - quasarframework-bdqfmg

Relevant log output

No response

Additional context

No response

chenweifang4 commented 1 year ago

image

glorat commented 1 year ago

Relevant line at https://github.com/quasarframework/quasar/blob/56c819d1f32ef191387626f1d5c33485e5dbc04d/app-vite/lib/config-tools.js#L120

The relevant Vite documentation is at https://vitejs.dev/config/build-options.html#build-sourcemap and Quasar is just reflecting the Vite documentation

Sooo.... it seems that Quasar is neither doing what its own docs say nor the Vite docs and is defaulting to "inline" when the config is true. Moreover, there seems to be no possible way of actually passing true through to Vite and therefore no way of generating separate sourcemap file.

Suggested code fix would simply be sourcemap: build.sourcemap ?? false

glorat commented 1 year ago

For those that are looking for a quick workaround, one can fortunately do sourcemap: 'true'

By setting it to a string, the quasar code passes it through (due to use of ===) but the vite code will respect the truthiness

dongwa commented 1 year ago

Relevant line at

https://github.com/quasarframework/quasar/blob/56c819d1f32ef191387626f1d5c33485e5dbc04d/app-vite/lib/config-tools.js#L120

The relevant Vite documentation is at https://vitejs.dev/config/build-options.html#build-sourcemap and Quasar is just reflecting the Vite documentation

Sooo.... it seems that Quasar is neither doing what its own docs say nor the Vite docs and is defaulting to "inline" when the config is true. Moreover, there seems to be no possible way of actually passing true through to Vite and therefore no way of generating separate sourcemap file.

Suggested code fix would simply be sourcemap: build.sourcemap ?? false

You can pr it😊

glorat commented 1 year ago

Relevant line at https://github.com/quasarframework/quasar/blob/56c819d1f32ef191387626f1d5c33485e5dbc04d/app-vite/lib/config-tools.js#L120

The relevant Vite documentation is at https://vitejs.dev/config/build-options.html#build-sourcemap and Quasar is just reflecting the Vite documentation Sooo.... it seems that Quasar is neither doing what its own docs say nor the Vite docs and is defaulting to "inline" when the config is true. Moreover, there seems to be no possible way of actually passing true through to Vite and therefore no way of generating separate sourcemap file. Suggested code fix would simply be sourcemap: build.sourcemap ?? false

You can pr it😊

Happy to do so

glorat commented 1 year ago

This issue is the same as issue #14946, which also has a similar fix #14109