elado / next-with-less

Next.js + Less CSS Support
MIT License
143 stars 24 forks source link

Can not use in next 12.0.xxx canary #18

Closed startmt closed 2 years ago

startmt commented 2 years ago

TypeError: Cannot read properties of undefined (reading 'oneOf') at Object.webpack (xxxx/node_modules/next-with-less/dist/index.js:66:15)

I can't use it in next lastest version

chemicalkosek commented 2 years ago

Update next-with-less to 2.0.2

nawafinity commented 2 years ago

Hello, I'm facing the same issue.

package.json

"dependencies": {
    "antd": "^4.17.2",
    "next": "12.0.5",
    "next-with-less": "^2.0.2",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  },

next.config.js

/** @type {import('next').NextConfig} */
const withLess = require("next-with-less");

module.exports = withLess({
    reactStrictMode: true,
    lessLoaderOptions: {}
})
chemicalkosek commented 2 years ago

Despite my previous comment, I can actually reproduce it too. So what was fixed in 2.0.2 resurfaced again with next: 12.0.5

tvervest commented 2 years ago

I'm having the same issue with the exact same setup, except I'm using next: 12.0.7

gino8080 commented 2 years ago

same error and but also using next-optimized-images

"dependencies": {
    "antd": "^4.16.13",
    "next": "12.0.7",
    "next-with-less": "^2.0.2",
    "next-optimized-images": "^2.6.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  }
TypeError: Cannot read property 'oneOf' of undefined
    at Object.webpack (PROJECT/node_modules/next-with-less/dist/index.js:66:15)
    at Object.webpack (PROJECT/node_modules/next-optimized-images/lib/index.js:66:27)
    at Object.getBaseWebpackConfig [as default] (PROJECT/node_modules/next/build/webpack-config.ts:1722:6)
    at async Promise.all (index 0)
    at Span.traceAsyncFn (PROJECT/node_modules/next/trace/trace.ts:96:14)
    at Span.traceAsyncFn (PROJECT/node_modules/next/trace/trace.ts:96:14)
    at HotReloader.start (PROJECT/node_modules/next/server/dev/hot-reloader.ts:438:21)
    at DevServer.prepare (PROJECT/node_modules/next/server/dev/next-dev-server.ts:389:5)
    at ViewService.onModuleInit (PROJECT/src/server/view/view.service.ts:18:7)
    at async Promise.all (index 0)
elado commented 2 years ago

Thanks for reporting. Fixed in 2.0.4.