Vite Plugin GLSL Import, inline (and compress) GLSL shader files Inspired bythreejs-glsl-loaderandvite-plugin-string, compatible withBabylon.js,three.jsandlygia. Installation npm i vite-plugin-glsl --save-dev#oryarn add vite-plugin-glsl --dev#orpnpm add -D vite-plugin-glsl#orbun add vite...
:spider_web: Import, inline (and compress) GLSL shader files :electric_plug: - vite-plugin-glsl/index.html at main · UstymUkhman/vite-plugin-glsl
This plugin enables a setup where you keep GLSL seperate from your JS while having all the advantages of glslify module resolution and runtime code injection, without having to deal with string interpolation, potentially loosing GLSL linting in the process, and in what I consider a cleaner forma...
import{defineConfig}from'vite';importplainTextfrom'vite-plugin-plain-text';exportdefaultdefineConfig({plugins:[plainText([/\/LICENSE$/,'**/*.text',/\.glsl$/],{namedExport:false,dtsAutoGen:true,distAutoClean:true},),],}); License
url'// 以字符串形式加载资源import assetAsString from './shader.glsl?raw'// 加载为 Web Workerimport Worker from './worker.js?worker'// 在构建时 Web Worker 内联为 base64 字符串import InlineWorker from './worker.js?worker&inline' 同一个文件,可能作为多个模块,例如 raw 时的编译产出的模块跟...
//显式加载资源为一个URLimportassetAsURLfrom'./asset.js?url'//以字符串形式加载资源importassetAsStringfrom'./shader.glsl?raw'//加载为WebWorkerimportWorkerfrom'./worker.js?worker'//在构建时WebWorker内联为base64字符串importInlineWorkerfrom'./worker.js?worker&inline' 同一个文件,可能作为多个模块,...
vite-plugin-glsl - Import shader file chunks. vite-plugin-svgo - Load SVGs as plain string and transform with SVGO library. vite-plugin-remark-rehype - Loads and transform markdown files using the unified ecosystem. vite-plugin-php - Load and process PHP-entry files instead of default inde...
importasyncUrlfrom'./async_demo.js?url';console.log(asyncUrl);/*/importassets/async_demo.js*/if(true){import(/* @vite-ignore */asyncUrl).then(m=>{console.log(m)// Module {Symbol(Symbol.toStringTag): "Module"}});}// 做字符串引入importshaderStringfrom'./shader.glsl?raw' ...
// 显式加载资源为一个 URL import assetAsURL from './asset.js?url' // 以字符串形式加载资源 import assetAsString from './shader.glsl?raw' // 加载为 Web Worker import Worker from './worker.js?worker' // 在构建时 Web Worker 内联为 base64 字符串 import InlineWorker from './worker.js...
import shaderString from './shader.glsl?raw' 导入脚本作为 Worker(即相当于开启一个新的进程进行处理) # 定义一个worker.ts文件 let num: number= 0export const timeoutCount= ():void=>{ num+= 1postMessage(num)//向进程派送信息setTimeout(timeoutCount, 1000) ...