From 1fd94b4b5ca9e4cb2489c3ba326345eb0ae71887 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sun, 17 Dec 2023 15:42:11 +0000 Subject: [PATCH] Really fix rollup --- rollup.config.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 147e267c..2c027e76 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -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(/(?:|,)\s*/, '') + .replace(/(?:|,)\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'],