Don't add asset hash to manifest json on build

This commit is contained in:
RMidhunSuresh 2022-04-18 16:17:56 +05:30
parent b7675f46c4
commit f16a2e5d22
1 changed files with 13 additions and 5 deletions

View File

@ -16,25 +16,33 @@ export default defineConfig(({mode}) => {
sourcemap: true,
rollupOptions: {
output: {
assetFileNames: (asset) => asset.name.includes("config.json") ? "assets/[name][extname]": "assets/[name].[hash][extname]",
assetFileNames: (asset) =>
asset.name.includes("config.json") ||
asset.name.match(/theme-.+\.json/)
? "assets/[name][extname]"
: "assets/[name].[hash][extname]",
},
},
},
plugins: [
themeBuilder({
themeConfig: {
themes: {"element": "./src/platform/web/ui/css/themes/element"},
themes: {
element: "./src/platform/web/ui/css/themes/element",
},
default: "element",
},
compiledVariables
compiledVariables,
}),
// important this comes before service worker
// otherwise the manifest and the icons it refers to won't be cached
injectWebManifest("assets/manifest.json"),
injectServiceWorker("./src/platform/web/sw.js", ["index.html"], {
// placeholders to replace at end of build by chunk name
"index": {DEFINE_GLOBAL_HASH: definePlaceholders.DEFINE_GLOBAL_HASH},
"sw": definePlaceholders
index: {
DEFINE_GLOBAL_HASH: definePlaceholders.DEFINE_GLOBAL_HASH,
},
sw: definePlaceholders,
}),
],
define: definePlaceholders,