Improve SSR debugging with SourceMap
See original GitHub issueVue.js version
2.x.x
Reproduction Link
Because it is a ssr issue and hard to provide a running demo online, please see Steps to reproduce
Steps to reproduce
- clone the https://github.com/vuejs/vue-hackernews-2.0.git repostory
- edit file
src/\components/ItemList.vue
to cause an error. For example:
// ...
import Spinner from './Spinner.vue'
import Item from './Item.vue'
import { watchList } from '../store/api'
// abc is a undeclared variable that can cause a ReferenceError
console.log(abc)
// ...
- then run
npm run build
,npm run start
in command line - open browser and navigate to http://localhost:8080
- the command line will report some error info as below:
error during render : /
ReferenceError: abc is not defined
at Object.module.exports.exports.default.props (__vue_ssr_bundle__:388:13)
at __webpack_require__ (__vue_ssr_bundle__:21:30)
at Object.module.exports.__vue_styles__ (__vue_ssr_bundle__:994:19)
at __webpack_require__ (__vue_ssr_bundle__:21:30)
at Object.module.exports.module.exports (__vue_ssr_bundle__:866:83)
at __webpack_require__ (__vue_ssr_bundle__:21:30)
at Object.<anonymous> (__vue_ssr_bundle__:650:80)
at __webpack_require__ (__vue_ssr_bundle__:21:30)
at Object.module.exports.exports.default.name (__vue_ssr_bundle__:224:66)
at __webpack_require__ (__vue_ssr_bundle__:21:30)
What is Expected?
The error info in the command line should include the specific file path and line number, for example:
ReferenceError: abc is not defined
at src/components/ItemList.vue (26:13)
...
What is actually happening?
Error info dose not include the file path and line number that cause the error to produce…
I know it is the bundle render that cause the error hard to locate. And is there any solution, like soucemap, that can solve this debug issuse with bundle render?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Improving Development with Source Maps for Debugging
We can ensure that we are using source maps for debugging bundled code. ... Specifically, a source map connects code that's been compiled, ......
Read more >Debug your React App like a Ninja with Source Maps
How to easily debug your React app with source maps (and no longer ... For more detailed information on Source Map — Ryan...
Read more >Advanced Features: Debugging - Next.js
This documentation explains how you can debug your Next.js frontend and backend code with full source maps support using either the VS Code...
Read more >JavaScript Debugging with Sourcemaps - TrackJS
The main purpose of sourcemaps is to aid debugging. Basically, if there's an error in the generated code file, the map can tell...
Read more >Fullstack TypeScript: Node.js + React SSR | Nils Mehlhorn
The other one will run in a user's browser and enhance these HTML ... enable sourcemaps for debugging and even remove the hash...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Implemented and will ship in 2.2.
First of all,
devtool: 'sourcemap'
has to be added towebpack.config
to enable source map output, which is not documented clearly. And I havemaps:[]
output in the bundle file, but I still get unclear error from node output. It’s not what I expected…