vuex-electron icon indicating copy to clipboard operation
vuex-electron copied to clipboard

[conf, ajv] DevTools failed to load SourceMaps

Open wojciechkrzysztofik opened this issue 4 years ago • 4 comments

Hey guys!

I spotted weird issue. It appears on development and production version as well. DevTools throws lots of warnings like: "DevTools failed to load SourceMap: Could not load content for http://localhost:8081/MY_APP_PATH/node_modules/conf/node_modules/ajv/dist/ajv.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE".

Any idea how to solve this?

It's vuex-electron v1.0.3, ajv v6.12.6 and conf v9.0.2.

wojciechkrzysztofik avatar Apr 06 '21 14:04 wojciechkrzysztofik

I've had this too, and couldn't find a way of either rewriting the URLs to they actually loaded, and I wanted source maps to be enabled for my own code, so I couldn't disable them. Temporarily, until I do find a solution, I've done this to to remove the sourceMappingURLs from the modules.

In package.json :

"scripts": {
  ...
  "postinstall": "./fix-node-module-source-maps.sh"
  ...
}

And in the root of my app, a file fix-node-module-source-maps.sh, set executable :

echo "Removing any sourceMappingURLs from ajv-formats"
for i in `find node_modules/ajv-formats -name \*.js -type f`
do
	perl -p -i.bak -e 's|//# sourceMappingURL=.*$||' $i
done

echo "Removing any sourceMappingURLs from conf"
for i in `find node_modules/conf -name \*.js -type f`
do
	perl -p -i.bak -e 's|//# sourceMappingURL=.*$||' $i
done

echo "Removing any sourceMappingURLs from url-js"
perl -p -i.bak -e 's|//# sourceMappingURL=.*$||' node_modules/uri-js/dist/es5/uri.all.js

You might not need the one for uri-js, but I did.

I suspect the answer is for these modules not to include sourceMappingURLs in their built files, it seems other modules don't include them. I'm new to Electron and npm, so I really don't know. It might be worth opening a ticket with them.

carldr avatar May 28 '21 10:05 carldr

This is actually (at least in part) from electron-store. I just started a fresh project and those source map errors started appearing the moment I added import ElectronStore from "electron-store";. This was before I even added vuex-electron!

ferm10n avatar Jun 19 '21 22:06 ferm10n

Also having this issue caused by electron-store Any solution so far? Thanks!

bart avatar Dec 22 '21 00:12 bart

Had this in a while, too.

Add this to your dependencies. Note this is not in devDependencies because I needed it somehow in the production build, too.

 "dependencies": {
    // ... your other dependencies.
    "source-map-support": "^0.5.16",
  },

Gkiokan avatar Jan 08 '22 13:01 Gkiokan