SolidZORO / next-plugin-antd-less

🎩 Use Antd (Less) with Next.js v12, Zero Dependency on other Next-Plugins.
MIT License
345 stars 48 forks source link

Exception in webpack while loading next-plugin-antd-less externals #55

Closed nishant-dani closed 3 years ago

nishant-dani commented 3 years ago

While trying to following the instructions to debug the nextjs app using --inspect and chrome://inspect the debugger breaks at this exception. I tracked it to external handling in the webpack config for next-plugin-antd-less. Would you have any tips on how to move forward or workaround this?

{ "code": "MODULE_NOT_FOUND", "requireStack": [ "/../node_modules/next/dist/build/webpack-config.js", "/../node_modules/next/dist/server/hot-reloader.js", "/../node_modules/next/dist/server/next-dev-server.js", "/../node_modules/next/dist/server/next.js", "/../node_modules/next/dist/server/lib/start-server.js", "/../node_modules/next/dist/cli/next-dev.js", "/../node_modules/next/dist/bin/next" ] }

Cannot find module 'next-plugin-loader?middleware=on-init-server!'

Error: Cannot find module 'next-plugin-loader?middleware=on-init-server!' "Error: Cannot find module 'next-plugin-loader?middleware=on-init-server!' Require stack:

In package.json, use this script: "debug": "NODE_OPTIONS='--inspect=0.0.0.0:9229' next dev",

Attach to the application with chrome://inspect

This is line 311 on the code;

[                                                                                                           
          // webpack4                                                                                               
          (ctx, req, cb) => {                                                                                       
            if (req.match(ANTD_STYLE_REGX)) return cb();                                                            

            if (typeof exts[0] === 'function') return exts[0](ctx, req, cb);        -- LINE 311                                
            else return cb();                                               
          },                                                                
          ...(typeof exts[0] === 'function' ? [] : exts),                    
        ];                                        
SolidZORO commented 3 years ago

This feels too complicated for me to read 😂.

nishant-dani commented 3 years ago

Sorry about the complex description. However, this got resolved by updating to the latest nextjs "next": "^10.2.0". Will keep tracking to see if it recurs.