Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esbuild-plugin is missing a name #483

Open
LukasKlement opened this issue Feb 10, 2024 · 7 comments
Open

esbuild-plugin is missing a name #483

LukasKlement opened this issue Feb 10, 2024 · 7 comments

Comments

@LukasKlement
Copy link

LukasKlement commented Feb 10, 2024

Trying to use the vite-plugin in an Angular application with angular-builders/custom-esbuild (https://github.com/just-jeb/angular-builders/tree/master/packages/custom-esbuild) produces the error on build: throw new Error(Plugin at index ${i} is missing a name);

In angular.json I use the builder: "builder": "@angular-builders/custom-esbuild:application" and in options "plugins": ["./vite.config.ts"],

The plugin is from the documentation - manual setup: https://docs.sentry.io/platforms/node/guides/connect/sourcemaps/uploading/vite/

Environment:

  • @angular/core 17.1.3
  • @angular-builders/custom-esbuild 17.1.0-beta.0
  • @sentry/vite-plugin 2.14.0
@lforst
Copy link
Member

lforst commented Feb 12, 2024

Hi, would you mind console logging your plugins on build and sharing them here? I cannot immediately spot where we would be missing a plugin name. Maybe the logs help us find the culprit.

@LukasKlement
Copy link
Author

These are the plugins being loaded (console logging node_modules/esbuild/lib/main.js):

[
  { name: 'angular-sourcemap-ignorelist', setup: [Function: setup] },
  { name: 'angular-compiler', setup: [AsyncFunction: setup] },
  { build: { sourcemap: true }, plugins: [ [Object] ] }
]

These are the items I get when logging the let item of plugins iterator:

{ name: 'angular-sourcemap-ignorelist', setup: [Function: setup] }
{ name: 'angular-compiler', setup: [AsyncFunction: setup] }
plugins:  [
  { name: 'angular-sourcemap-ignorelist', setup: [Function: setup] },
  { name: 'angular-polyfills', setup: [Function: setup] }
]
{ name: 'angular-sourcemap-ignorelist', setup: [Function: setup] }
{ name: 'angular-polyfills', setup: [Function: setup] }
plugins:  [
  { name: 'angular-styles-global', setup: [Function: setup] },
  { name: 'angular-sass', setup: [AsyncFunction: setup] },
  { name: 'angular-less', setup: [AsyncFunction: setup] },
  { name: 'angular-css', setup: [Function: setup] },
  { name: 'angular-css-resource', setup: [Function: setup] },
  { name: 'angular-css-inline-fonts-plugin', setup: [Function: setup] }
]
{ name: 'angular-styles-global', setup: [Function: setup] }
{ name: 'angular-sass', setup: [AsyncFunction: setup] }
{ name: 'angular-less', setup: [AsyncFunction: setup] }
{
  build: { sourcemap: true },
  plugins: [
    {
      '0': [Object],
      '1': [Object],
      '2': [Object],
      enforce: 'post',
      name: 'sentry'
    }
  ]
}
{ name: 'angular-css', setup: [Function: setup] }
{ name: 'angular-css-resource', setup: [Function: setup] }

The vite.config.ts is the one from your docs:

import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/vite-plugin";

export default defineConfig({
  build: {
    sourcemap: true,
  },
  plugins: [
    sentryVitePlugin({
      org: "my-org",
      project: "my-project",
      authToken: process.env.SENTRY_TOKEN,
    }),
  ],
});

@lforst
Copy link
Member

lforst commented Feb 19, 2024

Can you elaborate why you are using the vite plugin while using the esbuild Angular builder? Can you try using the @sentry/esbuild plugin instead?

@LukasKlement
Copy link
Author

LukasKlement commented Feb 19, 2024

Thanks for the note, apologies posted on the wrong plugin. The error is the same though, this is the config:

angular.json: "builder": "@angular-builders/custom-esbuild:application",

esbuild.config.ts:

import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import esbuild from "esbuild";

esbuild.build({
  sourcemap: true, // Source map generation must be turned on
  plugins: [
    // Put the Sentry esbuild plugin after all other plugins
    sentryEsbuildPlugin({
      org: "org",
      project: "project",
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
});

@LukasKlement LukasKlement changed the title vite-plugin is missing a name esbuild-plugin is missing a name Feb 19, 2024
@lforst
Copy link
Member

lforst commented Feb 20, 2024

I cannot reproduce this with the latest version of esbuild and the esbuild plugin. Would you mind sharing a small reproduction example? Thanks!

@LukasKlement
Copy link
Author

Hi, thanks - here's an example: https://stackblitz.com/edit/stackblitz-starters-ddzaip?file=src%2Fmain.ts
Indeed, I get the following error now: "Add only entry points to the 'files' or 'include' properties in your tsconfig."

@lforst
Copy link
Member

lforst commented Feb 23, 2024

@LukasKlement the stackblitz you shared doesn't contain any Sentry plugins 🤔 did you press save?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Community
Development

No branches or pull requests

2 participants