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

View File

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