Can't debug with Chrome
See original GitHub issueCurrent Behavior
When debugging with Chrome, the debugger does not show the scripts from webpack in the sources tab.
Expected Behavior
Source files are shown in the sources tab and it is possible to place breakpoints and debug the code, i.e.:
Haul Configuration (webpack.haul.js)
var webpack = require('webpack');
module.exports = ({ platform }, { module, resolve, plugins }) => ({
entry: `./src/index.${platform}.tsx`,
module: {
...module,
rules: [
{
test: /\.tsx?$/,
use: [
'babel-loader',
'ts-loader'
]
},
...module.rules
]
},
resolve: {
...resolve,
extensions: [
'.ts',
'.tsx',
`.${platform}.ts`,
'.native.ts',
`.${platform}.tsx`,
'.native.tsx',
...resolve.extensions
]
},
plugins: [
...plugins,
new webpack.optimize.ModuleConcatenationPlugin()
]
});
| software | version |
|---|---|
| Haul | 1.0.0-beta.4 |
| react-native | 0.47.1 |
| node | 7.9.0 |
| npm or yarn | 5.3.0 |
Other Information
While attempting to resolve this issue, I found that the file debuggerWorker.js is loading the app file using fetch, replacing 'this["webpackHotUpdate"]' with 'self["webpackHotUpdate"]' and then evaling it.
While this works (as in, the app works), I believe Chrome doesn’t understand that the files loaded through fetch should be added as source files.
I tried replacing the line
fetch(message.url).then(resp => resp.text()).then(evalJS);
with
try {
importScripts(message.url);
} catch (e) {
self.ErrorUtils.reportFatalError(e);
} finally {
self.postMessage({ replyID: message.id });
processEnqueuedMessages();
}
but this just left a blank screen. I had to use the following for it to actually work:
var error;
try {
importScripts(message.url);
} catch (e) {
error = e;
}
processEnqueuedMessages();
sendReply(null, error);
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Cannot debug with chrome - Visual Studio Feedback
- Enable javascript debugging for ASP.NET (Chrome and IE) to "True" - MVC Project with framework 4.5.2. Error message when press Debug (Triangle...
Read more >Chrome javascript debugger breakpoints don't do anything?
For debugger to work the 'Disable Cache' needs to be set under the Network tab or you will be running the cached code....
Read more >Debugging in the browser - The Modern JavaScript Tutorial
Before writing more complex code, let's talk about debugging. Debugging is the process of finding and fixing errors within a script.
Read more >Cannot debug with Chrome DevTools · Issue #583 - GitHub
When trying to debug Node.js code run with Sucrase, the Chrome DevTools can't find the source code because they look in the wrong...
Read more >Issues: Find and fix problems - Chrome Developers
# Open the Issues tab · Visit a page with issues to fix, such as samesite-sandbox.glitch.me. · Open DevTools. · Click the Open...
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 Free
Top 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

Try adding
devtool: 'eval-source-map',towebpack.haul.js.@zamotany
我按照source maps这个里面添加了: webpack.parts.js:
webpack.config.js:
并且将
webpack.haul.js中设置为仍然是显示一行,不能对文件中设置断点调试