Skip to content

Source map doesn't work for external dependency in preload script #24916

@panuhorsmalahti

Description

@panuhorsmalahti

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • v8.2.4
  • Operating System:
    • Windows 10 Pro (1903)
  • Last Known Working Electron version:
    • None

Expected Behavior

Source map should work in the application. At the minimum I would expect to not get source map parsing warnings in the developing console.

Actual Behavior

I get the warning "DevTools failed to parse SourceMap" for every source file for the dependency "typeorm". Example warning would be "DevTools failed to parse SourceMap: http://localhost:9001/ManyToMany.js.map". Source maps don't work for typeorm.

To Reproduce

Add "typeorm" as a dependency to the electron application. Mark it as commonjs external module. Use the dependency in the preload script.

Additional Information

The webpack config for the externals is:

externals: {
    // Specify dependencies that should be loaded as en external dependency, not bundled
    sqlite3: "commonjs sqlite3",
    typeorm: "commonjs typeorm"
}

I don't get source map parsing warnings for other dependencies. Each source file of "typeorm" has a comment "//# sourceMappingURL=ConnectionManager.js.map", which is probably why electron/Chromium is trying to load it from the root. I tried different "devtool" configuration settings in webpack, but that didn't help, probably because this external dependency is not bundled/processed by webpack, so the setting has no direct effect. My guess is that sqlite3 external dependency doesn't produce warnings is that the dependency doesn't include source maps in the npm package. (I'd also guess that source maps don't work for this dependency, but this is better than having the console completely filled with warnings).

It would be nice to get the source maps working, but just getting rid of the warnings would be nice.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions