mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-12 13:50:01 -04:00
fix infinite bundle size bug
This commit is contained in:
parent
3539de7c18
commit
6c6ace4336
5 changed files with 475 additions and 1014 deletions
3
frontend/filemap.js
Normal file
3
frontend/filemap.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
import index from "sw-filemap"
|
||||
|
||||
self.filemap = JSON.parse(index);
|
1
frontend/public/filemap.js
Normal file
1
frontend/public/filemap.js
Normal file
|
@ -0,0 +1 @@
|
|||
// file intentionally left empty
|
|
@ -6,10 +6,8 @@
|
|||
* However, if a user changes the location of uv.bundle.js/uv.config.js or sw.js is not relative to them, they will need to modify this script locally.
|
||||
*/
|
||||
|
||||
// import index from "sw-filemap"
|
||||
|
||||
// let filemap = JSON.parse(index);
|
||||
let filemap = {};
|
||||
self.filemap = {};
|
||||
importScripts("filemap.js");
|
||||
|
||||
importScripts('uv/uv.bundle.js');
|
||||
importScripts('uv.config.js');
|
||||
|
|
|
@ -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()
|
||||
|
|
1471
pnpm-lock.yaml
generated
1471
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue