Really fix rollup

This commit is contained in:
Jaifroid 2023-12-17 15:42:11 +00:00
parent 2e22b28bd7
commit 1fd94b4b5c

View File

@ -68,15 +68,21 @@ if (process.env.BUILD === 'production') {
{
src: ['KiwixWebApp*.jsproj'],
dest: 'dist',
// Modify the jsproj included files
transform: (contents, filename) => contents.toString()
// Replace the entry point with the bundle
.replace(/(www[\\/]js[\\/])app.js/, '$1bundle.min.js')
// Remove all the lib files that will be included in the bundle
.replace(/(?:<Content Include=)?['"]www[\\/]js[\\/]lib[\\/]cache[\s\S]+zimfile.js['"](?:\s*\/>|,)\s*/, '')
.replace(/(?:<Content Include=)?["']www[\\/]js[\\/]lib[\\/]cache[\s\S]+zimfile.js["'](?:\s*\/>|,)\s*/, '')
// Replace any references to node_modules
.replace(/node_modules[\\/].*dist[\\/]((?:js|css)[\\/])?/g, function (m, p1) {
p1 = p1 || 'js/';
return 'www/' + p1;
})
// Alter remaining lib references
.replace(/([\\/])js[\\/]lib/g, '$1js')
// Remove unneeded ASM/WASM binaries
.replace(/["']www[\\/]js[\\/].*dec.*js["'],\s*/g, '')
.replace(/['"]www[\\/]js[\\/].*dec.*js['"],\s*/g, '')
},
{
src: ['service-worker.js'],