vite-plugin / vite-plugin-commonjs

A pure JavaScript implementation for CommonJs
MIT License
105 stars 16 forks source link

ReferenceError: Cannot access 'G0' before initialization #47

Closed KolissnikBogdan closed 6 months ago

KolissnikBogdan commented 8 months ago

Hello, first of all I want to thank you for this wonderful package) I had this problem: "require is not defined vite" (after I created the build). I updated my vite.config by adding:

 commonjs({
      filter(id) {
        // `node_modules` is exclude by default, so we need to include it explicitly
        // https://github.com/vite-plugin/vite-plugin-commonjs/blob/v0.7.0/src/index.ts#L123-L125
        if (id.includes('node_modules/jssip')) {
          return true;
        }
      },
    }),

But now this error has appeared:

Снимок экрана 2024-01-31 в 17 50 19

Is it possible that I missed something in the settings of this package?

yejimeiming commented 6 months ago

Can you provide a minimal reproduction repo?

KolissnikBogdan commented 6 months ago

Can you provide a minimal reproduction repo?

I solved this problem by changing other properties of vite.config Thank you for your reply