Skip to content

esbuild plugin writing files to the incorrect location in Nx monorepo #1426

Open
@getabetterpic

Description

@getabetterpic

We're working on migrating to esbuild, but one problem we've run into is the HB esbuild plugin takes over the file writing to disk, but does so without respecting the output path that has been defined. This could be an Angular-specific thing potentially. The end result is the bundle files and sourcemaps are written to the workspace root directory instead of the dist folder where they belong.

We're running an Nx monorepo with several Angular applications in it. The relevant project.json looks like this:

"build": {
  "executor": "@nx/angular:application",
  "outputs": ["{workspaceRoot}/dist/{projectRoot}"],
  "options": {
  "outputPath": {
    "base": "{workspaceRoot}/dist/{projectRoot}",
    "browser": ""
  }
}

With Angular, the outputPath can be either a string or an object with base and browser keys. I think this may be where the problem lies. The HB sourcemap upload plugin is writing the files, but only using the file's path property, not looking at anything else, which to me means somewhere in the writing process the outputPath should be considered.

Edit: here's a reproducible repo https://github.com/getabetterpic/hb-esbuild. Running npx nx build app outputs all built files to the root workspace directory instead of in the dist folder.

Metadata

Metadata

Assignees

Labels

esbuild@honeybadger-io/esbuild-plugin

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions