-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning from vite about using eval #221
Comments
You can suppress the specific warning in the console for vite via the rollup options import { defineConfig } from 'vite';
export default defineConfig({
build: {
rollupOptions: {
onwarn(warning, warn) {
// Suppress "Use of eval in" warnings
if (warning.code === 'EVAL') {
/*
* Bottleneck has two instances of eval
* node_modules/bottleneck/lib/RedisConnection.js (18:21) Use of eval in "node_modules/bottleneck/lib/RedisConnection.js" is strongly discouraged as it poses security risks and may cause issues with minification.
* node_modules/bottleneck/lib/IORedisConnection.js (26:21) Use of eval in "node_modules/bottleneck/lib/IORedisConnection.js" is strongly discouraged as it poses security risks and may cause issues with minification.
*/
if (warning.id?.includes('RedisConnection.js')) {
return;
}
}
// Use default for everything else
warn(warning);
},
},
},
}) |
Thanks a lot @toddb ! |
Maybe the problem is vitejs/vite#13624 |
Strange because it did work for me as expected using Couple of notes:
Good luck! |
This solution did work for me. Thanks! |
Personally, not happy with tweaking the config, and given the lib seems not maintained anymore, I switched to https://github.com/sindresorhus/p-throttle. Works well. |
Bottleneck has served me well in a standalone typescript application (not involving Redis).
Now I moved this code inside an Electron application built using vite and the following warnings appear during build for development and production:
I don't use Redis.
Is it possible to load these modules only if Redis is used?
Well, seems everything works in spite of these warning, but they are annoying.
Thanks.
mario
The text was updated successfully, but these errors were encountered: