0

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.

1 Answers1

0

to resolve this question i used 2 steps: 1 - 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()],
  
});

2 - I used this config in my aws pipeline: https://stackoverflow.com/a/66889948/13507783