fix infinite bundle size bug

This commit is contained in:
CoolElectronics 2023-08-14 14:20:40 -04:00
parent 3539de7c18
commit 6c6ace4336
No known key found for this signature in database
GPG key ID: F63593D168636C50
5 changed files with 475 additions and 1014 deletions

View file

@ -19,8 +19,8 @@ const transform = options => {
return {
name: 'esbuild-sw-transformer',
setup(build) {
if (_fs.existsSync("./sw.js"))
fs.rm("./sw.js");
if (_fs.existsSync("./filemap.js"))
fs.rm("./filemap.js");
build.onResolve({ filter }, args => {
const realPath = args.path.replace(filter, '');
return {
@ -68,9 +68,9 @@ const transform = options => {
};
build({
entryPoints: ['../public/sw.js'],
entryPoints: ['../filemap.js'],
bundle: true,
outfile: 'sw.js',
outfile: 'filemap.js',
plugins: [
// Always include this plugin before others
transform()