Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Bug for build the project #4

Closed
tesshsu opened this issue Oct 20, 2020 · 2 comments
Closed

[Bug] Bug for build the project #4

tesshsu opened this issue Oct 20, 2020 · 2 comments

Comments

@tesshsu
Copy link

tesshsu commented Oct 20, 2020

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
Copy link

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
Copy link
Author

tesshsu commented Dec 31, 2020

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

@tesshsu tesshsu closed this as completed Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants