Breakpoints not working properly with devtool strategy in the Quasar document on fresh new project
See original GitHub issueProbably related issue: #8235 . This is not a duplicate. It may or may not be a document issue. I am unable to determine the reason.
In the quasar document https://quasar.dev/start/vs-code-configuration the devtool strategy devtool: 'source-map'
prevents breakpoints to work properly in VS Code with Chrome. I’ve successfully reproduced this bug in a fresh new quasar project.
By simply removing this line I am able to properly debug in Chrome, and it pauses properly at the breakpoint.
To reproduce
- Run
quasar create
, enter anything - Add
devtool: 'source-map'
to thebuild
section - Run
quasar dev
- Create a
launch.json
according to the document at https://quasar.dev/start/vs-code-configuration - Start VS Code. Just add a QButton to Index.vue. See the following section for the code. Set breakpoint at the first line of simulateProgress().
- It will break on loading of the page, which is unexpected. Press F5 to continue. Then click the button. This time it does not break at all.
- Now, to fix the problem above, just remove the `devtool: ‘source-map’ line. Stop and restart the debugger. This time it will only break at the that line when the button is clicked.
Expected behavior The breakpoint should work for VS Code with Chrome. And it should only break when it runs the given line.
Index.vue
<template>
<q-page class="flex flex-center">
<img
alt="Quasar logo"
src="~assets/quasar-logo-vertical.svg"
style="width: 200px; height: 200px"
/>
<q-btn
:loading="loading1"
color="secondary"
@click="simulateProgress(1)"
label="Button"
/>
</q-page>
</template>
<script>
export default {
name: "PageIndex",
data() {
return {
loading1: false
};
},
methods: {
simulateProgress(number) {
// we set loading state
this[`loading${number}`] = true;
// simulate a delay
setTimeout(() => {
// we're done, we reset loading state
this[`loading${number}`] = false;
}, 3000);
}
}
};
</script>
Just some copy-and-paste from QButton document.
quasar.conf not working properly (all lines are auto generated except the devtool config)
/*
* This file runs in a Node context (it's NOT transpiled by Babel), so use only
* the ES6 features that are supported by your Node version. https://node.green/
*/
// Configuration for your app
// https://v1.quasar.dev/quasar-cli/quasar-conf-js
/* eslint-env node */
const ESLintPlugin = require('eslint-webpack-plugin')
module.exports = function (/* ctx */) {
return {
// https://v1.quasar.dev/quasar-cli/supporting-ts
supportTS: false,
// https://v1.quasar.dev/quasar-cli/prefetch-feature
// preFetch: true,
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://v1.quasar.dev/quasar-cli/boot-files
boot: [
'axios',
],
// https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css
css: [
'app.scss'
],
// https://github.com/quasarframework/quasar/tree/dev/extras
extras: [
// 'ionicons-v4',
// 'mdi-v5',
// 'fontawesome-v5',
// 'eva-icons',
// 'themify',
// 'line-awesome',
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
'roboto-font', // optional, you are not bound to it
'material-icons', // optional, you are not bound to it
],
// Full list of options: https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build
build: {
vueRouterMode: 'hash', // available values: 'hash', 'history'
devtool: 'source-map',
// transpile: false,
// Add dependencies for transpiling with Babel (Array of string/regex)
// (from node_modules, which are by default not transpiled).
// Applies only if "transpile" is set to true.
// transpileDependencies: [],
// rtl: false, // https://v1.quasar.dev/options/rtl-support
// preloadChunks: true,
// showProgress: false,
// gzip: true,
// analyze: true,
// Options below are automatically set depending on the env, set them if you want to override
// extractCSS: false,
// https://v1.quasar.dev/quasar-cli/handling-webpack
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
chainWebpack (chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: [ 'js', 'vue' ] }])
},
},
// Full list of options: https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer
devServer: {
https: false,
port: 8080,
open: true // opens browser window automatically
},
// https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
framework: {
iconSet: 'material-icons', // Quasar icon set
lang: 'en-us', // Quasar language pack
config: {},
// Possible values for "importStrategy":
// * 'auto' - (DEFAULT) Auto-import needed Quasar components & directives
// * 'all' - Manually specify what to import
importStrategy: 'auto',
// For special cases outside of where "auto" importStrategy can have an impact
// (like functional components as one of the examples),
// you can manually specify Quasar components/directives to be available everywhere:
//
// components: [],
// directives: [],
// Quasar plugins
plugins: []
},
// animations: 'all', // --- includes all animations
// https://v1.quasar.dev/options/animations
animations: [],
// https://v1.quasar.dev/quasar-cli/developing-ssr/configuring-ssr
ssr: {
pwa: false
},
// https://v1.quasar.dev/quasar-cli/developing-pwa/configuring-pwa
pwa: {
workboxPluginMode: 'GenerateSW', // 'GenerateSW' or 'InjectManifest'
workboxOptions: {}, // only for GenerateSW
manifest: {
name: `Quasar App`,
short_name: `Quasar App`,
description: `A Quasar Framework app`,
display: 'standalone',
orientation: 'portrait',
background_color: '#ffffff',
theme_color: '#027be3',
icons: [
{
src: 'icons/icon-128x128.png',
sizes: '128x128',
type: 'image/png'
},
{
src: 'icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'icons/icon-256x256.png',
sizes: '256x256',
type: 'image/png'
},
{
src: 'icons/icon-384x384.png',
sizes: '384x384',
type: 'image/png'
},
{
src: 'icons/icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}
},
// Full list of options: https://v1.quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova
cordova: {
// noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing
},
// Full list of options: https://v1.quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor
capacitor: {
hideSplashscreen: true
},
// Full list of options: https://v1.quasar.dev/quasar-cli/developing-electron-apps/configuring-electron
electron: {
bundler: 'packager', // 'packager' or 'builder'
packager: {
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options
// OS X / Mac App Store
// appBundleId: '',
// appCategoryType: '',
// osxSign: '',
// protocol: 'myapp://path',
// Windows only
// win32metadata: { ... }
},
builder: {
// https://www.electron.build/configuration/configuration
appId: 'newchrome'
},
// More info: https://v1.quasar.dev/quasar-cli/developing-electron-apps/node-integration
nodeIntegration: true,
extendWebpack (/* cfg */) {
// do something with Electron main process Webpack cfg
// chainWebpack also available besides this extendWebpack
}
}
}
}
Versions
OS: Windows
Node: 14
Browser: Chrome 91.0.4472.77
Pkg quasar: v1.15.20
Pkg @quasar/app: v2.2.9
Dev mode: spa
VS Code: 1.56.2
VS Code Extension: Debugger for Chrome
: v4.12.12
package.json auto generated by quasar cli
{
"name": "newchrome",
"version": "0.0.1",
"description": "A Quasar Framework app",
"productName": "Quasar App",
"author": "xxxx <xxxxx@xxxxx.xxx>",
"private": true,
"scripts": {
"lint": "eslint --ext .js,.vue ./",
"test": "echo \"No test specified\" && exit 0"
},
"dependencies": {
"@quasar/extras": "^1.0.0",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"quasar": "^1.0.0"
},
"devDependencies": {
"@quasar/app": "^2.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-vue": "^7.7.0",
"eslint-webpack-plugin": "^2.4.0"
},
"browserslist": [
"last 10 Chrome versions",
"last 10 Firefox versions",
"last 4 Edge versions",
"last 7 Safari versions",
"last 8 Android versions",
"last 8 ChromeAndroid versions",
"last 8 FirefoxAndroid versions",
"last 10 iOS versions",
"last 5 Opera versions"
],
"engines": {
"node": ">= 10.18.1",
"npm": ">= 6.13.4",
"yarn": ">= 1.21.1"
}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (1 by maintainers)
Top GitHub Comments
Having the same issue: Can’t set breakpoints in Vue files in VSCode on Win10.
Finally got it to work using:
Where junk2 is the project root directory
Beat. Further update…
Tried using cheap-source-map in quasar.conf.js and now all breakpoints are being hit. Is this some kind of caching issue?
For the life of me, I swear I have tried every combination of ‘sourceMapPathOverrides’ people have suggested and I just cant get it to hit my breakpoints.