babel-plugin-glsl
babel-plugin-glsl copied to clipboard
Incompatibility with modern build tools
As you are aware modern frontend toolings do not support old node modules importing.
I am using Vite
and i get the following error by importing 'babel-plugin-glsl/macro'
indicating that process is not accessible.
Uncaught ReferenceError: process is not defined
at node_modules/path-parse/index.js
I tried bypassing it with adding define: {'process.env': process.env}
to the vite.config.js
but i got the same error for utils.inherits
which i couldn't fix and i think it's a chain of many errors.
I saw the same errors on new versions of webpack
as well.
I assume rethinking the code for better compatibility with modern build tools is the best approach in here.
It's work with me. https://github.com/vitejs/vite/issues/1973#issuecomment-787571499
Yes that would fix the problem as long as the only missing file that you need is process.env
But as i stated earlier if you miss other packages too this won't fix it
@sarended hey I am suffering from this issue too have you found a way to work around?
@momentchan sadly no. at the end i had to code the functions completely module-free since that the module be used.
@sarended Thank you, got it. yes I ended up doing the same thing.
@GoreStarry's solution worked, but then I got a different error: Uncaught TypeError: Unable to determine current node version
.
More details here
To those that are still struggling with this, I spent hours trying to make it work with different solutions. What ended up working for me is using vite-plugin-glslify-inject
and removing this library completely as a dependency.