mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 21:06:34 +00:00
Fix source URLs in source maps (#17585)
This commit is contained in:
parent
f4d575f456
commit
cba246fc7f
@ -8,7 +8,7 @@ module.exports.sourceMapURL = () => {
|
|||||||
const ref = env.version().endsWith("dev")
|
const ref = env.version().endsWith("dev")
|
||||||
? process.env.GITHUB_SHA || "dev"
|
? process.env.GITHUB_SHA || "dev"
|
||||||
: env.version();
|
: env.version();
|
||||||
return `https://raw.githubusercontent.com/home-assistant/frontend/${ref}`;
|
return `https://raw.githubusercontent.com/home-assistant/frontend/${ref}/`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Files from NPM Packages that should not be imported
|
// Files from NPM Packages that should not be imported
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const webpack = require("webpack");
|
const { existsSync } = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const webpack = require("webpack");
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
||||||
const log = require("fancy-log");
|
const log = require("fancy-log");
|
||||||
@ -191,19 +192,23 @@ const createWebpackConfig = ({
|
|||||||
// Since production source maps don't include sources, we need to point to them elsewhere
|
// Since production source maps don't include sources, we need to point to them elsewhere
|
||||||
// For dependencies, just provide the path (no source in browser)
|
// For dependencies, just provide the path (no source in browser)
|
||||||
// Otherwise, point to the raw code on GitHub for browser to load
|
// Otherwise, point to the raw code on GitHub for browser to load
|
||||||
devtoolModuleFilenameTemplate:
|
...Object.fromEntries(
|
||||||
!isTestBuild && isProdBuild
|
["", "Fallback"].map((v) => [
|
||||||
? (info) => {
|
`devtool${v}ModuleFilenameTemplate`,
|
||||||
const sourcePath = info.resourcePath.replace(/^\.\//, "");
|
!isTestBuild && isProdBuild
|
||||||
if (
|
? (info) => {
|
||||||
sourcePath.startsWith("node_modules") ||
|
if (
|
||||||
sourcePath.startsWith("webpack")
|
!path.isAbsolute(info.absoluteResourcePath) ||
|
||||||
) {
|
!existsSync(info.resourcePath) ||
|
||||||
return `no-source/${sourcePath}`;
|
info.resourcePath.startsWith("./node_modules")
|
||||||
|
) {
|
||||||
|
return new URL(info.resourcePath, "webpack://frontend/").href;
|
||||||
|
}
|
||||||
|
return new URL(info.resourcePath, bundle.sourceMapURL()).href;
|
||||||
}
|
}
|
||||||
return `${bundle.sourceMapURL()}/${sourcePath}`;
|
: undefined,
|
||||||
}
|
])
|
||||||
: undefined,
|
),
|
||||||
},
|
},
|
||||||
experiments: {
|
experiments: {
|
||||||
outputModule: true,
|
outputModule: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user