Después de actualizar a nextjs 10.1.3 , tuve un error cuando lancé yarn dev .
error - ./public/static/style.scss Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin' Require stack: - /path_to/node_modules/mini-css-extract-plugin/dist/loader.js - /path_to/node_modules/next/dist/compiled/webpack/bundle4.js - /path_to/node_modules/next/dist/compiled/webpack/webpack.js - /path_to/node_modules/next/dist/next-server/server/config-utils.js - /path_to/node_modules/next/dist/next-server/server/config.js - /path_to/node_modules/next/dist/next-server/server/next-server.js - /path_to/node_modules/next/dist/server/next.js - /path_to/node_modules/next/dist/server/lib/start-server.js - /path_to/node_modules/next/dist/cli/next-dev.js - /path_to/node_modules/next/dist/bin/next Could not find files for /[lang] in .next/build-manifest.json Could not find files for /[lang] in .next/build-manifest.json event - compiled successfullyEncontré ese problema similar pero no resolvió mi problema.
Eliminé paquetes y bloqueé archivos, y también traté de instalar webpack, etc. leyendo esto .
Lo que me llevó a otro error sobre tap lo que me llevó a esto , así que eliminé lo que acabo de hacer, así que vuelvo al primer error anterior.
Aquí está mi next.config.js
const withSass = require('@zeit/next-sass'); const withCSS = require("@zeit/next-css"); module.exports = withCSS(withSass({ webpack(config, options) { config.module.rules.push({ test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, use: { loader: 'url-loader', options: { limit: 100000 } } }); return config; } }));así que tengo una configuración similar a la que tienes, es decir, Next.js con Antd y Less. Recibí este error recientemente después de actualizar a la última versión de nextjs (10.2.0). Afortunadamente para mí, me topé con esta pregunta e hice clic en el enlace Problema similar que adjuntaste y obtuve la solución a partir de ahí. Resolví esto instalando webpack
npm i webpack@webpack-4 --save-dev
Esperemos que esto le ahorre tiempo a alguien más :). Salud
En mi caso el proyecto a mantener consta de Next.js (9.3.2), Antd, Less, Typescript.
Simplemente REVERTIR lo que ha hecho para solucionar este problema primero y luego ejecute el comando:
yarn upgrade next 10.2.3 yarn add webpack@webpack-4 --devLa paciencia es una de las claves que obtuve en este viaje.
El escenario de actualización del desglose de la versión next.js está aquí:
yarn add isomorphic-unfetch no ayudará en nada, por lo tanto, actualizar la versión next.js es la única opciónnext build && next export , la pila superior mini-css-extract-plugin/dist/loader.js localiza el error Cannot find module 'webpack/lib/node/NodeTemplatePlugin'yarn add webpack@webpack-4 --dev ;next build && next export