Skip to content

@rollup/plugin-terser incompatible with Node JS 14.x #1871

@joelwatson

Description

@joelwatson
  • Rollup Plugin Name: Terser
  • Rollup Plugin Version: 0.4.3, 0.4.4
  • Rollup Version: 3.x
  • Operating System (or Browser): Mac OS
  • Node Version: 14.21.3

The docs for Terser suggest that the minimal version of Node required is 14.x. However, beginning with Terser v.0.4.3, the following error occurs:

[!] (plugin terser) TypeError: sources.at is not a function
    at file:///___/node_modules/smob/src/module.ts:193:39
    at Object.renderChunk (file:///___/node_modules/@rollup/plugin-terser/dist/es/index.js:172:30)
    at /___/node_modules/rollup/dist/shared/rollup.js:1914:40

This is because [email protected] is using Array.at which wasn't added to node until 16.x

For others encountering this issue, I found that downgrading @rollup/plugin-terser to 0.4.2 resolves the error and appears to work as expected.

I DO think the documentation should be updated, as Node 14 will not work out of the box with this plugin in versions beyond 0.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions