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

DevTools cannot load SourceMap files (net::ERR_NAME_NOT_RESOLVED) #7

Closed
bric3 opened this issue Jun 28, 2021 · 3 comments
Closed

DevTools cannot load SourceMap files (net::ERR_NAME_NOT_RESOLVED) #7

bric3 opened this issue Jun 28, 2021 · 3 comments
Labels
developer experience wontfix This will not be worked on

Comments

@bric3
Copy link
Owner

bric3 commented Jun 28, 2021

I opened a ticket on JCEF about sourcemap not available in DevTools, see
https://bitbucket.org/chromiumembedded/java-cef/issues/403/devtools-cannot-load-sourcemap-files-net


I have Java code that expose a progressive web app via JCEF. However the third-party web-app javascript is minified. They do provide source maps however. This works fine in a usual browser.

However when running inside a JCEF frame, the devtools cannot load these source maps.

DevTools failed to load SourceMap: Could not load content for https://my-app/2.c9d7d260.chunk.js.map: Connection error: net::ERR_NAME_NOT_RESOLVED
DevTools failed to load SourceMap: Could not load content for https://my-app/main.a7bce6af.chunk.js.map: Connection error: net::ERR_NAME_NOT_RESOLVED
DevTools failed to load SourceMap: Could not load content for https://my-app/main.0d980f3a.chunk.css.map: Connection error: net::ERR_NAME_NOT_RESOLVED

I am registering a custom scheme handler

CefApp.getInstance().registerSchemeHandlerFactory(
    "https", appDomain,
    SchemeHandlerFactory { uri: URI ->
        BufferedInputStream(WebView::class.java.getResourceAsStream("/assets" + uri.path))
    }
).also { successful -> assert(successful) }

I even tried to hook a request handler

object : CefRequestHandlerAdapter() {
    override fun getResourceRequestHandler(
        browser: CefBrowser?,
        frame: CefFrame?,
        request: CefRequest?,
        isNavigation: Boolean,
        isDownload: Boolean,
        requestInitiator: String?,
        disableDefaultHandling: BoolRef?
    ): CefResourceRequestHandler? {
        println(request)
        return super.getResourceRequestHandler(
            browser,
            frame,
            request,
            isNavigation,
            isDownload,
            requestInitiator,
            disableDefaultHandling
        )
    }
}.also { requestHandler ->
    cefBrowser.client.addRequestHandler(requestHandler)
    lifetime.onTermination {
        cefBrowser.client.removeRequestHandler()
    }
}

Debugging at these location didn’t help much, as I don’t see any request to https://my-app/2.c9d7d260.chunk.js.map for example.

I am not sure if this is a bug or a missing feature, or simply a misuse.


I even tried to add this request handler on the devtool browser cefBrowser.devTools

@bric3 bric3 added developer experience help wanted Extra attention is needed labels Jun 28, 2021
@bric3
Copy link
Owner Author

bric3 commented Jun 28, 2021

@bric3 bric3 added wontfix This will not be worked on and removed help wanted Extra attention is needed labels Jun 28, 2021
@bric3
Copy link
Owner Author

bric3 commented Jun 28, 2021

It seems I can't do anything about it, within the boundary of this project.

@bric3 bric3 closed this as completed Jun 28, 2021
@bric3
Copy link
Owner Author

bric3 commented Jul 1, 2021

Workaround in facebook/create-react-app#790 (comment), by using react-script-rewired and passing a custom webpack configuration override.

module.exports = function override(config, env) {
    // see https://webpack.js.org/configuration/
    console.log("Disabling build minimizer (config-overrides.js)");
    config.mode = "development";
    config.optimization.minimize = false;
    config.optimization.minimizer = [];

    // https://webpack.js.org/configuration/devtool/
    console.log("Inline SourceMaps (config-overrides.js)");
    config.devtool = 'inline-source-maps'


    return config;
};

The non modifiable webpack config passed to react-script is located here : excalidraw-assets/node_modules/react-scripts/config/webpack.config.js

bric3 added a commit that referenced this issue Jul 1, 2021
The webapp is now built with a override of the default
react-script webpack config, this override disables
optimizations and inline source maps.

Workaround of facebook/create-react-app#790, by using
`react-script-rewired` and passing a custom webpack
configuration override.

The non-modifiable webpack config passed to react-script is
located here :
`excalidraw-assets/node_modules/react-scripts/config/webpack.config.js`

Related to #7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer experience wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant