Reputation: 311
I had this error in my pipeline aws: Module level directives cause errors when bundled, 'use client' was ignored causing JavaScript heap out of memory
I want a solution for this problem considering that i am using vite.js on my react.js app.
Upvotes: 11
Views: 13524
Reputation: 311
to resolve this question I used 2 steps:
add this code into vite.config.js:
export default defineConfig({
build: {
chunkSizeWarningLimit: 100,
rollupOptions: {
onwarn(warning, warn) {
if (warning.code === "MODULE_LEVEL_DIRECTIVE") {
return;
}
warn(warning);
},
},
},
plugins: [react()],
});
I used this config in my AWS pipeline: https://stackoverflow.com/a/66889948/13507783
Upvotes: 10