mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Lazy load JSZip
This commit is contained in:
parent
58f9b8d8b1
commit
0844e9e0c1
1 changed files with 9 additions and 1 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import JSZip from "../node_modules/jszip/dist/jszip"; // Hack
|
||||
import SKIN_SPRITES from "./skinSprites";
|
||||
import regionParser from "./regionParser";
|
||||
import {
|
||||
|
|
@ -8,6 +7,14 @@ import {
|
|||
} from "./constants";
|
||||
import { parseViscolors, parseIni, getFileExtension } from "./utils";
|
||||
|
||||
const getJSZip = () => {
|
||||
return new Promise(resolve => {
|
||||
require.ensure("../node_modules/jszip/dist/jszip", require => {
|
||||
resolve(require("../node_modules/jszip/dist/jszip"));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const shallowMerge = objs =>
|
||||
objs.reduce((prev, img) => Object.assign(prev, img), {});
|
||||
|
||||
|
|
@ -240,6 +247,7 @@ async function genGenTextSprites(zip) {
|
|||
|
||||
// A promise that, given an array buffer returns a skin style object
|
||||
async function skinParser(zipFileBuffer) {
|
||||
const JSZip = await getJSZip();
|
||||
const zip = await JSZip.loadAsync(zipFileBuffer);
|
||||
const [
|
||||
colors,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue