Tobin
Tobin

Reputation: 2018

webpack-concat-text-plugin "node" is incompatible

The concat-text-webpack-plugin is nested deep in some package, and errors when I have NextJS and Node 18.

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=8 <=16". Got "18.16.0"
error Found incompatible module.

It's fine with Node 16. Looking into the package code there is a line

"engines": {
    "node": ">=8 <=16"
},

which blocks using Node 18+. The repo is archived and cannot be PR'd.

How can I use this with Node 18+?

Upvotes: 1

Views: 611

Answers (2)

Matt Korostoff
Matt Korostoff

Reputation: 2132

For me, this error came from the fact that:

  1. concat-text-webpack-plugin was required by serverless-bundle
  2. I was running an outdated version of serverless-bundle

Serverless bundle resolved this in the 6.0 release, so to solve this in my codebase, I ran yarn upgrade serverless-bundle@6 which removed the bad dependency and allowed me to upgrade to node 18.

Since serverless-bundle is very popular, it's likely this solution will work for most people. If your codebase includes concat-text-webpack-plugin through some other package, you can find the culprit by running yarn why concat-text-webpack-plugin which will show the top-level package causing this dependency. You can then most likely upgrade the top level package.

Upvotes: 2

Tobin
Tobin

Reputation: 2018

This lead me down a rabbit hole and I have come out a much better developer. I forked the repo, and rewrote the tests to work with Node 18+ and Webpack 5. The tests relied on some knarly behaviour of webpack which was completely removed from v4 => v5.

I published a package here https://www.npmjs.com/package/concat-text-webpack-plugin-2023

The key bit is that the original package is regularly a nested dependency. This new version has the same API as the original and has included README on how to make the resolutions work with nested deps.

Upvotes: 1

Related Questions