From 280d730e293fe91aa0af87ad8819dd3555b340c4 Mon Sep 17 00:00:00 2001 From: Matt Nichols Date: Sat, 18 Nov 2023 13:01:12 -0800 Subject: [PATCH] Fix minified shader parsing in build --- package-lock.json | 4 ++-- package.json | 2 +- vite.config.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9989c38..142ea98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sketchbook2", - "version": "0.2.5", + "version": "0.2.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sketchbook2", - "version": "0.2.5", + "version": "0.2.6", "dependencies": { "@types/js-cookie": "^3.0.3", "isbot": "^3.7.0", diff --git a/package.json b/package.json index 8b9f88c..04361f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sketchbook2", - "version": "0.2.5", + "version": "0.2.6", "private": true, "scripts": { "dev": "vite dev", diff --git a/vite.config.ts b/vite.config.ts index 10996cb..496185d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -20,8 +20,8 @@ function viteGlslify() { // Match a couple different formats of parsed files if (code.startsWith('export default ')) { code = code.replace('export default "', '').slice(0, -1); - } else if (code.includes('export {\n')) { - const afterDef = code.split(/= "/)[1]; + } else if (/export\s*{/.test(code)) { + const afterDef = code.split(/=\s*"/)[1]; code = afterDef.split(/";\n/)[0]; } else { throw new Error(`Unexpected shader file format for ${id}: ${code}`);