question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't load sourcemaps for node modules in renderer

See original GitHub issue

image

The modules themselves are working fine, and the sourcemaps are there in their respective folders in node_modules, but the renderer can’t load them:

DevTools failed to load source map: Could not load content for http://127.0.0.1:5173/resolve.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

I didn’t see any existing issues about this so maybe something to do with my setup:

/* eslint-env node */

import vue from "@vitejs/plugin-vue";
import { join } from "path";
import { defineConfig } from "vite";
import renderer from "vite-plugin-electron-renderer";

const PACKAGE_ROOT = __dirname;

export default defineConfig({
    mode: process.env.MODE,
    root: PACKAGE_ROOT,
    envDir: process.cwd(),
    resolve: {
        alias: {
            "@": join(PACKAGE_ROOT, "src"),
            "!": join(PACKAGE_ROOT, "assets"),
            $: join(PACKAGE_ROOT, "../common"),
        },
    },
    base: "",
    server: {
        fs: {
            strict: true,
        },
    },
    build: {
        sourcemap: true,
        target: `es2022`,
        outDir: "dist",
        assetsDir: ".",
        rollupOptions: {
            input: join(PACKAGE_ROOT, "index.html"),
            output: {
                entryFileNames: "[name].cjs",
            },
        },
        emptyOutDir: true,
        reportCompressedSize: false,
        lib: {
            entry: "src/index.ts",
            formats: ["cjs"],
        },
    },
    plugins: [
        vue(),
        renderer({
            resolve() {
                return ["path", "fs", "stream", "os", "child_process", "node-fetch", "spring-map-parser", "tachyon-client", "sdfz-demo-parser", "octokit"];
            },
        }),
    ],
});

Any ideas how I can fix these, or otherwise hide the warnings?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
caoxiemeihaocommented, Oct 27, 2022

The next version will be generate .map.js into .vite-electron-renderer

1reaction
Jazcashcommented, Sep 3, 2022

Ok, I found that installing https://github.com/vite-plugin/vite-plugin-esmodule fixes most of these warnings

Read more comments on GitHub >

github_iconTop Results From Across the Web

DevTools failed to load SourceMap for webpack ...
The source map you are trying to load is in node_modules and not part of webpack bundle. "If not extracted and processed into...
Read more >
yarn dev result has error Cannot find module 'source-map ...
Clone repo. Run yarn. Run yarn dev. Built app launches with an error already displayed in the open devtools console. Uncaught Error: Cannot...
Read more >
source-map-loader - webpack
The source-map-loader will extract from any JavaScript file, including those in the node_modules directory. Be mindful in setting include and exclude rule ...
Read more >
could not load content for webpack - You.com | The AI Search ...
The source map you are trying to load is in node_modules and not part of webpack bundle. "If not extracted and processed into...
Read more >
Using Source Maps - Javascript Honeybadger Documentation
Node.js Integration Guide · Server-Side Rendering. Uploading Your Source Map. Upload your source map(s) every time you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found