Build failed because of webpack errors

See original GitHub issue

node:16.4.0 using the template with-typescript-tailwindcss

Build error occurred
Error: > Build failed because of webpack errors
    at C:\Users\zhxie\Program files\Github\nuxt-electrion\node_modules\next\dist\build\index.js:15:924
    at async Span.traceAsyncFn (C:\Users\zhxie\Program files\Github\nuxt-electrion\node_modules\next\dist\telemetry\trace\trace.js:6:584)

after use ‘yarn build’

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

25reactions
juicyjusungcommented, Aug 19, 2021

@TRUEJASONFANS I don’t know if this is the right solution.

next.config.js

module.exports = {
  webpack: (config, { isServer }) => {

    if (!isServer) {
      config.target = 'electron-renderer';
      config.node = {
        __dirname: true,
      }
    }
    return config;
  },
};

5reactions
larskarbocommented, Aug 20, 2021

@TRUEJASONFANS I don’t know if this is the right solution.

next.config.js

module.exports = {
  webpack: (config, { isServer }) => {

    if (!isServer) {
      config.target = 'electron-renderer';
      config.node = {
        __dirname: true,
      }
    }
    return config;
  },
};

This worked for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

next build fails with webpack error #25276 - GitHub
I'm using webpack 4 and started receiving this error today in my monorepo after updating next. Fixed it for now by using "next":...
Read more >
nextJS build fails on Vercel because of Webpack errors
I got help from support, it seems that even though my local components are Capitalized the remote branch had some components lowercased.
Read more >
Build Failure Because of Webpack Errors - Sanity.io
hey, beautiful people, I'm trying to deploy to vercel and I'm getting this series of errors ./pages/episodes/[slug].js11 :33: 35.354Module ...
Read more >
Build failed because of webpack errors (Next.js + AWS Amplify)
Hi, I'm working on a Next.js + AWS Amplify project, but I can't get it deployed :frowning: I did quite a few researches...
Read more >
Build Failed - Web App - Build issue - AppGyver forums
All of a sudden my web builds are failing to build with the below error. Nothing had changed since the last build except...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found