pacocoursey / next-unused

Find unused files in your Next.js projects
422 stars 14 forks source link

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined #3

Closed dpkpaa closed 3 years ago

dpkpaa commented 4 years ago

after running yarn find:unused getting UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined i am using next@9.2.2

borispoehland commented 4 years ago

+1 also got this

omar-dulaimi commented 3 years ago

I'm getting the same error as well.

pacocoursey commented 3 years ago

Can you share your next-unused configuration?

ernestoweb commented 3 years ago

Hi for me issue was in index.js line 71

madge(madgePath, {
    webpackConfig: path.resolve(__dirname, "madge.webpack.js"),
   **-> tsConfig: path.resolve(process.cwd(), "tsconfig.json"),**
    excludeRegExp: [searchDirs, ...exclude, "(^|\/)(\.(?!\.).+)$"],
    fileExtensions: ["js", "jsx", "ts", "tsx"],
  }).then((res) => { 

I just commented the line as I guess it is a remaining part of Typescript and then it works.

BTW Very useful package - thanks

pacocoursey commented 3 years ago

Fixed in 0.0.3, thanks!