@crxjs/vite-plugin 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +24 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1038,7 +1038,7 @@ function htmlFiles(manifest) {
|
|
|
1038
1038
|
manifest.options_ui?.page,
|
|
1039
1039
|
manifest.sandbox?.pages,
|
|
1040
1040
|
manifest.side_panel?.default_path
|
|
1041
|
-
].flat().filter(isString).map((s) => s.split(
|
|
1041
|
+
].flat().filter(isString).map((s) => s.split(/[#?]/)[0]).sort();
|
|
1042
1042
|
return [...new Set(files)];
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
@@ -1713,13 +1713,18 @@ const pluginManifest = () => {
|
|
|
1713
1713
|
let filename = join(config.root, f);
|
|
1714
1714
|
if (!existsSync(filename))
|
|
1715
1715
|
filename = join(config.publicDir, f);
|
|
1716
|
-
if (!existsSync(filename))
|
|
1716
|
+
if (!existsSync(filename)) {
|
|
1717
|
+
const viteMajorVersion = parseInt(version.split(".")[0]);
|
|
1718
|
+
if (viteMajorVersion < 4 && filename.endsWith(".map") && config.build.sourcemap === true) {
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1717
1721
|
throw new Error(
|
|
1718
1722
|
`ENOENT: Could not load manifest asset "${f}".
|
|
1719
1723
|
Manifest assets must exist in one of these directories:
|
|
1720
1724
|
Project root: "${config.root}"
|
|
1721
1725
|
Public dir: "${config.publicDir}"`
|
|
1722
1726
|
);
|
|
1727
|
+
}
|
|
1723
1728
|
this.emitFile({
|
|
1724
1729
|
type: "asset",
|
|
1725
1730
|
fileName: f,
|
|
@@ -1985,6 +1990,23 @@ const pluginWebAccessibleResources = () => {
|
|
|
1985
1990
|
delete war.use_dynamic_url;
|
|
1986
1991
|
}
|
|
1987
1992
|
}
|
|
1993
|
+
for (const war of combinedResources) {
|
|
1994
|
+
const resourcesWithMaps = [];
|
|
1995
|
+
for (const res of war.resources) {
|
|
1996
|
+
resourcesWithMaps.push(res);
|
|
1997
|
+
if (bundle[res]?.type === "chunk") {
|
|
1998
|
+
const chunk = bundle[res];
|
|
1999
|
+
if (chunk.map) {
|
|
2000
|
+
const sourcemapFileName = chunk.sourcemapFileName || `${chunk.fileName}.map`;
|
|
2001
|
+
const viteMajorVersion = parseInt(version.split(".")[0]);
|
|
2002
|
+
if (sourcemapFileName in bundle || viteMajorVersion < 4 && config.build.sourcemap == true) {
|
|
2003
|
+
resourcesWithMaps.push(sourcemapFileName);
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
war.resources = resourcesWithMaps;
|
|
2009
|
+
}
|
|
1988
2010
|
if (combinedResources.length === 0)
|
|
1989
2011
|
delete manifest.web_accessible_resources;
|
|
1990
2012
|
else
|