Skip to content

Angular 19 Application Builder (ESBuild) - ESM Incompatibility with prettier/standalone #761

@souravion

Description

@souravion

Problem description

A build error occurs when deploying an Angular 19 project to Netlify, using the @angular-devkit/build-angular:application builder. The error indicates an incompatibility related to prettier/standalone, used as a CommonJS module within the @stedi/prettier-plugin-jsonata package. The full error message is:

prettier/standalone' used by 'node_modules/@stedi/prettier-plugin-jsonata/dist/lib/index.js' is not ESM

Steps to reproduce

  • Create a new Angular 19 project using the Angular CLI.
  • Install @stedi/prettier-plugin-jsonata and Prettier (version 3.0 or later).
  • Configure angular.json to use the @angular-devkit/build-angular:application builder.
  • Ensure esModuleInterop: true is set in tsconfig.json.
  • Attempt to build the project (ng build --configuration production) or deploy it to Netlify.

Expected behavior

The Angular 19 application should build and deploy successfully without errors related to module resolution or ESM/CommonJS incompatibility.

Troubleshooting steps attempted

  • Confirmed esModuleInterop: true is present in tsconfig.json.
  • Added @stedi/prettier-plugin-jsonata to allowedCommonJsDependencies within the build options in angular.json, notes GitHub,.
  • Ensured the Node.js version in the Netlify build environment is 18 or later, compatible with Angular 19 and Prettier 3+.
  • Verified that Prettier version 3.0 or later is installed in the project

Environment details

  • Angular Version: 19.0.0
  • Angular CLI Version: 17.3.13
  • Builder: @angular-devkit/build-angular:application
  • Node.js Version 20.15.1
  • @stedi/prettier-plugin-jsonata Version: ^2.1.5
  • Deployment Platform: Netlify

Various troubleshooting steps, including setting allowedCommonJsDependencies, were explored, but the issue persists. This indicates a potential deeper incompatibility between the plugin's structure and the Angular 19 application builder's ESM-first approach. Any guidance or potential solutions would be appreciated

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