I believed the npm run serve
command use the sourcemap by default for the js, but it seems not because I always see vue.runtime.esm.js:619
.
I made a vue.config.js file at the root level project.
I try two things:
module.exports = {
configureWebpack: config => {
config.devtool = 'source-map'
}
}
and:
module.exports = {
configureWebpack: {
devtool: 'source-map'
}
}
None of them works. I still stuck with vue.runtime.esm.js:619
which is useless.
Does anyone know how really activate the source-map with vue-cli 4?
Sentry supports demangling of transpiled, minified, and bundled JavaScript using source maps, which are JSON files that contain information about how to map your deployed code back to its original source(s).
To solve the error "'vue-cli-service' is not recognized as an internal or external command, operable program or batch file", install the @vue/cli-service package globally by running npm install -g @vue/cli-service and clear your npm cache.
In a sense, source maps are the decoder ring to your secret (minified) code. Using Webpack, specifying devtool: "source-map" in your Webpack config will enable source maps, and Webpack will output a sourceMappingURL directive in your final, minified file.
You can verify that it is properly installed by simply running vue , which should present you with a help message listing all available commands.
"source-map" yields source maps for both scss and typescript. Any insight here? Sorry, something went wrong. @nicooprat Which file? vue.config.js?
C:\vhosts\app.devesources\assets\js\views\Home.vue C:\vhosts\app.devesources\assets\js\app.js
Source maps can be either: If you use Webpack in your project, we recommend generating and uploading your source maps by way of sentry-webpack-plugin. If you use a different tool to generate source maps, you can use sentry-cli to upload them to Sentry.
"eval-source-map" does not yield maps for either scss or typescript. "source-map" yields source maps for both scss and typescript.
Using the generated vue.config.js from vue-cli v4 (generating a vue 3 project) It provided me this file:
// vue.config.js
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
})
I then modified it to this:
// vue.config.js
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
devtool: 'source-map',
}
})
Which works enough for me to enable VSCode debugging in Chrome/Electron.
*Edit
The error you are getting may be unrelated to source-maps and related to warnings from vue itself.
For example
runtime-core.esm-bundler.js:6584
[Vue warn]: Failed to resolve component: AMadeUpComponentName
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <MyView onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< null > >
at <RouterView>
at <App>
Unfortunately this is a limitation of vue. However, improvements have been made between VueJS v2 and v3. Finally, I couldn't find an original source, but I read that improving the warning messages to track down the cause of warnings and errors is a high priority feature.
I had an older project that this answer didn't solve at all. After a yarn upgrade
and @vue/cli
upgrading, this configuration began working again!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With