basics / nuxt-booster

nuxt-booster will help you to improve the lighthouse performance score (100/100) of your website. 🚀
https://basics.github.io/nuxt-booster/
MIT License
649 stars 32 forks source link

Speedkit breakes complete page #823

Closed iparker closed 1 year ago

iparker commented 1 year ago

Hello,

I want to try speedkit in a nuxt 2 app with vuetify, pwa and a lot of other stuff and modules. The page is rendered in ssr-mode.

I installed speedkit via npm and set the following base-config:

speedkit: {
    detection: {
      performance: true,
      browserSupport: true,
    },

    performanceMetrics: {
      device: {
        hardwareConcurrency: {min: 2, max: 48},
        deviceMemory: {min: 2},
      },
      timing: {
        fcp: 800,
        dcl: 1200,
      },
    },

    fonts: [],

    targetFormats: ['webp', 'avif', 'jpg|jpeg|png|gif'],

    componentAutoImport: false,
    componentPrefix: undefined,

    /**
     * IntersectionObserver rootMargin for Compoennts and Assets
     */
    lazyOffset: {
      component: '0%',
      asset: '0%',
    },

    loader: {
      dataUri: null,
      size: '100px',
      backgroundColor: 'grey',
    },

    disableNuxtImage: true,
  },

Next to this I did not change anything (no layout, no component).

When I now build and start the page is completely broken and I got the following error:

caught ReferenceError: global is not defined
    at f (d66aa00.modern.js:1:19545)
    at Module.<anonymous> (d66aa00.modern.js:1:21730)
    at 56 (d66aa00.modern.js:1:23424)
    at o (d66aa00.modern.js:1:588)
    at 54 (d66aa00.modern.js:1:19610)
    at o (d66aa00.modern.js:1:588)
    at c (d66aa00.modern.js:1:445)
    at Array.d [as push] (d66aa00.modern.js:1:308)
    at e08e80a.modern.js:1:47
f

Any ideas how to debug and fix this?

Best regards,

Timo

ThornWalli commented 1 year ago

Hello @iparker,

could you show your whole nuxt.config?

It's very strange that it doesn't find global, as if something is imported into Node that is only used in the runtime.

iparker commented 1 year ago

Thanks for your reply!

Is it ok if I send you my nuxt.config via email?

ThornWalli commented 1 year ago

@iparker Yes!

boruchy commented 1 year ago

The same issue is replicated on my end with the latest speedkit (2.2.3). Was there a solution that fixed it?

ThornWalli commented 1 year ago

@boruchy

Can you share your nuxt & node version and nuxt.config?

boruchy commented 1 year ago

@ThornWalli can I email you the config as well?

ThornWalli commented 1 year ago

@boruchy yes!

ThornWalli commented 1 year ago

@boruchy Can you remove the module nuxt-webpack-optimisations and see if it works then?

ThornWalli commented 1 year ago

If there is something new, it can be opened again.

muratdemir0 commented 1 year ago

@ThornWalli can I email you the config as well?

ThornWalli commented 1 year ago

@muratdemir0 yes 🙂

mahdi-hsoumi commented 10 months ago

@ThornWalli i have same issue

Uncaught ReferenceError: global is not defined
    at isSupportedBrowser (browser.mjs:3:48)
    at Module.<anonymous> (entry.js:79:44)
    at ./.nuxt/nuxt-speedkit/entry.js (app.js:1181:30)
    at __webpack_require__ (bootstrap:853:1)
    at fn (bootstrap:150:1)
    at 0 (app.js:1194:18)
    at __webpack_require__ (bootstrap:853:1)
    at checkDeferredModules (bootstrap:45:1)
    at Array.webpackJsonpCallback [as push] (bootstrap:32:1)
    at app.js:1:57
boruchy commented 9 months ago

@boruchy Can you remove the module nuxt-webpack-optimisations and see if it works then?

Thanks for the suggestion! I no longer get the global issue after some upgrades, but now trying to run npm run dev or run start (which just starts nuxt really) just quits nuxt silently without an error. I traced this down to speedkit V2.2.4. removing it starts the project normally

ThornWalli commented 9 months ago

@mahdi-hsoumi @boruchy @iparker

I have updated the v2. Now the global is no longer used.