You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting from v3.0.0, Vite uses node: imports which are supported in v16.0.0+ and v14.18.0+ of Node.js.
This is a intended breaking change because Node v15 is already EOL.
In v0.3.0 this plugin was updated to be a pure ESM, this means it cannot be require()'d from CommonJS anymore.
The goal of this issue is to demonstrate how vite-plugin-glsl should be used in case you're experiencing some problems after installation and what are some possible workarounds.
1. Recommended Usage:
Update your project to an ESM module by adding "type": "module" in your package.json. When using <npm|yarn|pnpm> create vite this comes by default with Vite v3.0.0+.
In your vite.config.js (or vite.config.ts) use this plugin as usual:
If for any reason you cannot add "type": "module" to you package.json, be sure to rename your vite.config file to vite.config.mjs (or vite.config.mts).
This will allow you to import this package by using top-level-await:
If you're stuck with a CommonJS project and for some reason you don't want to (or cannot) rename your vite.config file, you can use an async function to define a config object in your vite.config.js (or vite.config.ts):
Starting from
v3.0.0
, Vite usesnode:
imports which are supported inv16.0.0+
andv14.18.0+
of Node.js.This is a intended breaking change because Node
v15
is already EOL.In
v0.3.0
this plugin was updated to be a pure ESM, this means it cannot berequire()
'd from CommonJS anymore.The goal of this issue is to demonstrate how
vite-plugin-glsl
should be used in case you're experiencing some problems after installation and what are some possible workarounds.1. Recommended Usage:
Update your project to an ESM module by adding
"type": "module"
in yourpackage.json
. When using<npm|yarn|pnpm> create vite
this comes by default with Vitev3.0.0+
.In your
vite.config.js
(orvite.config.ts
) use this plugin as usual:2. CommonJS Project With Config Module:
If for any reason you cannot add
"type": "module"
to youpackage.json
, be sure to rename yourvite.config
file tovite.config.mjs
(orvite.config.mts
).This will allow you to import this package by using top-level-await:
3. CommonJS Project Without Config Module:
vite.config
file, you can use anasync
function to define a config object in yourvite.config.js
(orvite.config.ts
):As a last resort, if anything above don't work in you case, you can still use
v0.2.2
of this plugin by running:Here you can find more info about Vite
v3.0.0
and this is a great Gist about ESM packages.The text was updated successfully, but these errors were encountered: