creativetimofficial/notus-nextjs

[Bug] Bug for build the project

tesshsu opened this issue · 2 comments

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 ?

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>`

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