Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: resolve load source-map error #804

Closed
BlackHole1 opened this issue Jul 21, 2021 · 4 comments
Closed

[bug]: resolve load source-map error #804

BlackHole1 opened this issue Jul 21, 2021 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@BlackHole1
Copy link
Collaborator

BlackHole1 commented Jul 21, 2021

Reproduce Step

  1. open flat
  2. open devtools at renderer
  3. switch console
  4. (option) click WeChat Login button:
    图片

Note

launch Flat when development environment:
图片

if click weChat Login button:
图片


if open the release Flat:
图片

if click weChat Login button:
图片

@BlackHole1 BlackHole1 added bug Something isn't working good first issue Good for newcomers labels Jul 21, 2021
@yamasite
Copy link
Contributor

yamasite commented Sep 8, 2021

Solution

Just had some time to check this issue and found a similar reported issue here:
electron/electron#22996 (comment)

This is an issue with Electron, which incorrectly resolves the sourceMappingURL generated by Webpack devtool. So, you need to correct the path.

Steps

Option1: Update preload.js

If you update the following code in preload.js

//# sourceMappingURL=preload.js.map

with

//# sourceMappingURL=file:///location/to/preload.js.map

The issue will go away. This applies to both dev and prod.

image

Option 2: Update webpack.common.js

Add devtoolModuleFilenameTemplate to webpack.common.js:

module.exports = {
  //...
  output: {
    ...
    devtoolModuleFilenameTemplate:
      'file:///[absolute-resource-path]',
  },
};

The warning will also go away.

@yamasite
Copy link
Contributor

yamasite commented Sep 8, 2021

See #938 for the fix.

@BlackHole1
Copy link
Collaborator Author

Thanks for the PR!

@BlackHole1
Copy link
Collaborator Author

I will test it tomorrow. Everything seems to be fine so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants