clean up manifest step more

This commit is contained in:
Erin 2023-07-28 05:28:06 -04:00
parent f8c68847ca
commit bd843e5317

View file

@ -129,28 +129,21 @@ export function buildConfig ({
},
plugins: [
{
// emit other assets
buildStart () {
assets.forEach(absolutePath => {
this.emitFile({
type: 'asset',
fileName: getOutputFilename(absolutePath),
source: readFileSync(absolutePath),
});
});
},
load (id) {
if (id === manifestPath) {
// throwaway contents, replaced later
return 'debugger;';
}
return null;
},
renderChunk (code, chunk) {
if (chunk.facadeModuleId !== manifestPath) {
return null;
}
return JSON.stringify(manifestContent, null, '\t');
assets.forEach(absolutePath => this.emitFile({
type: 'asset',
fileName: getOutputFilename(absolutePath),
source: readFileSync(absolutePath),
}));
},
// hacks to make sure the manifest is emitted as bare JSON
load: id => id === manifestPath ? 'debugger;' : null,
renderChunk: (_, chunk) =>
chunk.facadeModuleId === manifestPath
? JSON.stringify(manifestContent, null, '\t')
: null,
},
],
},