creativetimofficial / notus-nextjs

Notus NextJS: Free Tailwind CSS UI Kit and Admin
https://www.creative-tim.com/product/notus-nextjs
MIT License
1.35k stars 1.68k forks source link

[Bug] Bug for build the project #4

Closed tesshsu closed 3 years ago

tesshsu commented 4 years ago

Version

1.0.0

Reproduction link

https://github.com/creativetimofficial/notus-nextjs?ref=twnjs-index

Operating System

node js

Device

desktop

Browser & Version

chrome 86.0.4240.75

Steps to reproduce

  1. npm install ( install the project from https://github.com/creativetimofficial/notus-nextjs)
  2. npm run dev ( développe the project )
  3. npm run build

What is expected?

Build in .next file

What is actually happening?

Build error occurred Error: > Build failed because of webpack errors at build (C:\Users\TESS\Documents\GitHub\01car.fr\front\node_modules\next\dist\build\index.js:15:918) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5)


Solution

Had install webpack, no work change next.config.js module.exports = { distDir: 'build', }

Still got the same error

Additional comments

Might be had to change the webpack version ?

Adamkaram commented 3 years ago

No the proplem is with next.config.js i have had the same issue for 3 hours but finally i fix it still here is my answer > chang this entire file script to ` const withPlugins = require("next-compose-plugins"); const withImages = require("next-images"); const withSass = require("@zeit/next-sass"); const withCSS = require("@zeit/next-css"); const withFonts = require("next-fonts"); const path = require("path");

module.exports = withFonts( withCSS( withImages( withSass({ cssLoaderOptions: { // this solves the issue url: false }, webpack(config, options) { config.module.rules.push({ test: /.(woff|woff2|eot|ttf|otf)$/, test: /.xml$/, use: { loader: "url-loader", loader: 'xml-loader',

        },
      });
      config.resolve.modules.push(path.resolve("./"));
      return config;
    },
  })
)

)

);` and in page/_app.js

PUT THAT URL IN HEAD TAG <style>{@import url(https://use.fontawesome.com/releases/v5.6.3/css/all.css)}</style>

tesshsu commented 3 years ago

Tks, my case was some component which had import but should be used but not been used And it is resolved in this case