harlan-zw / unlighthouse

Scan your entire site with Google Lighthouse in 2 minutes (on average). Open source, fully configurable with minimal setup.
https://unlighthouse.dev
MIT License
3.68k stars 105 forks source link

Webpack integration doesn't work #125

Closed toto1384 closed 4 months ago

toto1384 commented 1 year ago

Describe the bug

next.config.js

...
const config = withSuperjson()(withTM(withBundleAnalyzer({
    ....    
    async webpack(config,app){
        const WebpackPlugin = (await import('@unlighthouse/webpack')).default
        console.log('webpack plugin')
        config.plugins.unshift(
            WebpackPlugin()
        )
        return config
    }
})))

...

unlighthouse.config.ts

export default {
    site: 'http://localhost:3000',
    debug: true,
    scanner: {
        device: 'mobile',
        samples: 2,
        maxRoutes: 2000,
    },
}

When i run pnpm run dev nothing happens with the lighthouse server. Any help?

My usecase is booting a lighthouse server so i can link to it or show it in my crm

Don't know if it helps but I use a monorepo

Reproduction

Install the @unlighthouse/webpack and add the configurations as the above specified

System / Nuxt Info

System:
    OS: macOS 13.1
    CPU: (8) arm64 Apple M1
    Memory: 456.02 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 9.5.0 - /opt/homebrew/bin/npm
    Watchman: 2023.03.06.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 113.0.5672.126
    Firefox: 111.0
    Safari: 16.2