-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now edits to GLSL files will cause dev server to automatically update the page, as expected. Previously only worked for the GLSL files directly imported by JS. Done by patching dependencies; should try to get some version of these changes merged upstream. See vitejs/vite#9723
- Loading branch information
Showing
3 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/glslify/index.js b/node_modules/glslify/index.js | ||
index 7bb9ede..3942421 100644 | ||
--- a/node_modules/glslify/index.js | ||
+++ b/node_modules/glslify/index.js | ||
@@ -45,7 +45,7 @@ function iface () { | ||
if (!opts) opts = {} | ||
var depper = gdeps(opts) | ||
var deps = depper.inline(src, opts.basedir || basedir) | ||
- return bundle(deps) | ||
+ return { source: bundle(deps), deps } | ||
} | ||
function file(filename, opts) { | ||
if (!opts) opts = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/node_modules/rollup-plugin-glslify/index.js b/node_modules/rollup-plugin-glslify/index.js | ||
index 85474ec..2c1e423 100644 | ||
--- a/node_modules/rollup-plugin-glslify/index.js | ||
+++ b/node_modules/rollup-plugin-glslify/index.js | ||
@@ -58,7 +58,12 @@ module.exports = function glslify(userOptions = {}) { | ||
options | ||
); | ||
|
||
- code = compile(code, fileOptions); | ||
+ const { source, deps } = compile(code, fileOptions); | ||
+ code = source; | ||
+ | ||
+ for (const dep of deps.filter(dep => !dep.entry)) { | ||
+ this.addWatchFile(dep.file); | ||
+ } | ||
|
||
if (typeof options.compress === 'function') { | ||
code = options.compress(code); | ||
@@ -67,7 +72,7 @@ module.exports = function glslify(userOptions = {}) { | ||
} | ||
|
||
return { | ||
- code: `export default ${JSON.stringify(code)}; // eslint-disable-line`, | ||
+ code: `export default ${JSON.stringify(source)}; // eslint-disable-line`, | ||
map: { mappings: '' } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters