Skip to content

Commit

Permalink
Fix minified shader parsing in build
Browse files Browse the repository at this point in the history
  • Loading branch information
flatpickles committed Nov 18, 2023
1 parent 36e580f commit 280d730
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sketchbook2",
"version": "0.2.5",
"version": "0.2.6",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit 280d730

Please sign in to comment.