3.0.0-rc.3
https://github.com/vuejs/vue-cli
.vue
component so that the javascript code will throw an exceptionnpm run serve
The browser console should display the line number where the exception is being thrown in the .vue
file
The browser console displays an unhelpful error message referencing only vue.runtime.esm.js
When creating a new project using vue-cli via create or UI, no vue.config.js file is created by default. In order to see the line number of an exception in your source code, you have to manually create vue.config.js
and add the following:
module.exports = {
configureWebpack: {
devtool: 'source-map'
}
}
It seems to me that everyone would like to be able to source their errors, so I feel that this should be done by default.
Can't reproduce.
Source maps are enabled by default in dev mode:
https://github.com/vuejs/vue-cli/blob/e17f78c6c5abb8547de8cc26d56659d846c65242/packages/%40vue/cli-service/lib/config/dev.js#L3-L5
What browser are you on?
Chrome 67. The issue occurs consistently unless I add the config file I described.
Cannot reproduce. Working as intended in Chrome 67.
I'm having the same issue...
Reproduced in Chrome 68.
Adding the devtool configuration as per this issue's top post solved it.
Happily seeing the real filenames of where errors occur now (albeit the line number corresponds to the js-compiled version of the .vue files and not the original .vue file)
@lane-s Modifying vue.config.js as you instructed works for me
My @vue/cli-service is @ 3.0.1
Hi,
My Vue developer experience has been suffering due to terrible debugging/source maps:
I've added:
configureWebpack: {
devtool: 'source-map'
}
Which helped (now when I console.log()
somewhere- it knows the actual file!). However, it is still super unhelpful for generic errors.
Here's an example of a simple undefined error- and it NOT pointing to a file-
Does the above look right? How come it doesn't tell me the line/file the error came from?
No vue.config.js created here either. Latest vue-cli from npm, Linux Ubuntu 18.04 LTS.
Reopen.
Just create one. Not every initial configuration combination requires one, so it's not necessarily created for you.
The right way to enable source-map
module.exports = {
configureWebpack: (config) => {
config.devtool = 'source-map'
},
};
This config was pretty slow on file change, this one seems to be faster (we can also use the simpler object notation):
module.exports = {
configureWebpack: {
devtool: 'eval-source-map',
}
}
Found here: https://github.com/symfony/webpack-encore/issues/214. More config for Webpack, didn't try others: https://webpack.js.org/configuration/devtool/
+++ super fast, ++ fast, + pretty fast, o medium, - pretty slow, -- slow
This was a huge help for me. Without 'source-map'
I wasn't able to inspect import modules during debugging without jumping through hoops. Now I can, BUT only for normal .JS files. Doesn't seem to work with SFC .vue files...
I do have to note that 'eval-source-map'
didn't seem to work for me. Unsure if that is the default value, but using that yielded the same results as not setting the devtool
property.
@yarnball Has the problem been resolved?
"eval-source-map"
does not yield maps for either scss or typescript."source-map"
yields source maps for both scss and typescript.Any insight here?
Most helpful comment
The right way to enable source-map