Skip to content

terser-webpack-plugin with Next.js + Webpack 4 #198

@fatihtelis

Description

@fatihtelis

Summary

I'm using Next.js with Webpack 4 and when I add a fallback page to pages/_offline, terser-webpack-plugin gives the error below:

TypeError: Cannot read property 'javascript' of undefined
at /Users/xxxxxxxxx/node_modules/terser-webpack-plugin/dist/index.js:572:38

I searched for the issue and terser-webpack-plugin@5+ is for Webpack 5 and is not compatible with Webpack 4.

How To Reproduce

Steps to reproduce the behavior:

  1. Use [email protected] which has a dependency for terser-webpack-plugin: "^5.1.1" (Only compatible with Webpack 5)
  2. Use next.js with Webpack 4
  3. Add a fallback page to pages/_offline.js
  4. Get error while building the app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions