Questions tagged [esbuild]

esbuild is a fast bundler for JavaScript and its related languages (e.g. TypeScript, JSX, JSON, and CSS) with support for both the browser and node. This tag is specific for the esbuild bundler and is not used for general questions about bundling ES modules.

Filter by
Sorted by
Tagged with
0 votes
0 answers
6 views

how to cherry pick specific esbuild binaries when installing with yarn

I'm installing vite react template, yarn stuck somewhere and when I check with --verbose I saw so many redundant packages installed like those. verbose 3.383394574 Performing "GET" request ...
nerkn's user avatar
  • 1,900
0 votes
0 answers
11 views

Problems when bundling a express/sequelize/sqlite app using esbuild

Edit I've been bamboozled with regards to the sequelize part. The person responsible by connecting the gateway was pointing to an old endpoint and the answer was returning wrong as a result. I was ...
lsimonetii's user avatar
0 votes
0 answers
22 views

Angular ESBuild Configuration (e.g. --define)

As of Angular 17, it is possible to build and serve with esbuild instead of webpack 1. With webpack there was a way use a custom webpack config for things like: Providing browser polyfills for ...
Clashsoft's user avatar
  • 11.6k
0 votes
0 answers
4 views

esbuild define different loader for filetype depending on path

For svg files we need some to be loaded as text for a third-party library and all the rest to be imported as file, is it possible to provide different loaders for paths?
DEfusion's user avatar
  • 5,543
0 votes
1 answer
27 views

Using YAML files in esbuild

My app is using the contents of YAML files (for i18next translations). When developing using create-react-app (and CRACO), the YAML files are being read no problem 👍. However after building my app ...
Alan P.'s user avatar
  • 2,926
1 vote
2 answers
63 views

Trying to make Angular dependency injection work

My Angular dependencies aren't working and I don't know why. All the resources I've seen indicate that this should work: import { Component } from '@angular/core'; import { ActivatedRoute } from '@...
Luke Bretscher's user avatar
-1 votes
0 answers
17 views

Does esbuild let me provide an alias to my ./src directory?

Does esbuild let me provide an alias to my ./src directory? Like $src/foo.js, similar to how Webpack does it.
chovy's user avatar
  • 73.2k
1 vote
0 answers
41 views

Use ESBuild plugins for decorators with NX

I have created a Node.js project with Typescript with nx using the command nx g @nx/node:application [name] --framework none --projectNameAndRootFormat derived Here is the build configuration in my ...
Fredrik Wallén's user avatar
0 votes
0 answers
53 views

Failed to resolve module specifier error - After an upgrade to angular 17

I'm upgrading my Angular project from angular V16 to V17, by following the official Angular guide https://update.angular.io/?l=2&v=16.0-17.0 After performing the upgrade and running the project in ...
DEV_404_NF's user avatar
0 votes
0 answers
56 views

Space getting trim while extracting the PDF document using "pdfjs-dist" ( pdfjs ) package in nodejs Application

while extracting the pdf document into text i'm getting an issue, its removing extra space and converting into single space Attached the pdf doc image for ref - enter image description here. PDF data -...
Gaurav Goyal's user avatar
0 votes
1 answer
84 views

What is needed for a node/typescript dynamic import to work? "await import(node:fs/promises)"

Per the below, I've tried a wide number of different configurations, platforms, targets, etc, too long to list here and read the specifications, but the following is a bit of a mystery, so I'm finally ...
jonas's user avatar
  • 21
0 votes
0 answers
70 views

Proper way for a Typescript (node:) import in electron browser app?

I'm building a typescript project which runs in a browser. Everything works great, have gotten far, but I have now imported an additional module which internally imports some things like so: const ...
jonas's user avatar
  • 21
0 votes
0 answers
32 views

Use different path when bundling for node or browser with esbuild

I have a typescript project that I'm bundling for 2 platforms - node and browser with esbuild. In common folder I have a dependency (EventEmitter) which is platform- dependent. So in common I want to ...
Olena Horal's user avatar
  • 1,194
3 votes
1 answer
143 views

esbuild couldn't be built successfully using node v20 yarn v4 nodeLinker pnpm

I'm tring to install my projects packages with these: node v20.9.0 yarn v4.0.2 yarnrc -> nodeLinker: pnpm system -> Ubuntu 23.10 multiple package project (using workspaces in the root package....
Masoud Alipour's user avatar
1 vote
1 answer
116 views

Custom webpack config in angular esbuild

Currently my Angular project uses a custom webpack configuration file. "builder": "@angular-builders/custom-webpack:browser", "options": { ...
user3623300's user avatar
0 votes
0 answers
33 views

TypeScript file paths aren't working when I try to bootstrap Angular app using esbuild

I have set up jsbundling-rails with esbuild on a Rails 6 app with the goal of running Angular. The TypeScript compilation seems to be working fine, and I've copied in the official starter application. ...
Luke Bretscher's user avatar
0 votes
0 answers
23 views

Styles not applied when creating component library using styled-components bundled with tsup

I have created a component library using styled-components and published it as an NPM package. I bundled it using tsup (which uses esbuild). My issue is that some (most) of the styles are not being ...
a1.thomas's user avatar
1 vote
0 answers
48 views

Can't use TS/JS decorators with jsbundling/esbuild on Rails

I'm trying to get Angular to run in a Rails 6 project. I have installed the jsbundling-rails (with esbuild) and typescript-rails gems to load my JavaScript and TypeScript files. What should happen is ...
Luke Bretscher's user avatar
0 votes
0 answers
24 views

Installing Summernote in Rails 7 with NPM and Esbuild

In my new Rails 7 project I want to install the summernote editor: https://summernote.org/getting-started/#without-bootstrap-lite So I did: yarn add summernote In my application.js: import '...
almo's user avatar
  • 6,187
1 vote
1 answer
268 views

What is the difference between the "browser-esbuild" and "application" builders?

Docs description I saw this in the documentation but I was confused. Could anyone explain it to me better? At first I thought that "application" was for SSR but I don't know the real ...
Marcos Paulo's user avatar
0 votes
0 answers
124 views

Angular application built with esbuild use browser directory as output

I just upgraded an application to angular 17 where the angular.json configuration is the following: "outputPath": "../SFPD.Workflows/wwwroot", It's important that the compiled ...
ssougnez's user avatar
  • 5,385
0 votes
0 answers
53 views

how to remove duplicate codes when bundling with esbuild

I'm currently working on a backend project and I'm using nodejs and express. I also use esbuild to bundle my code. here's my build script : "build": "esbuild src/server.ts --bundle --...
MRT's user avatar
  • 1
0 votes
0 answers
28 views

How can I get a firebase query to work with esbuild?

I followed the tutorial on the firebase docs for 'Using Firebase with esbuild'. My project consists of one .html file and one .mjs file. The .html file contains: <!DOCTYPE html> <html lang=&...
peinearydevelopment's user avatar
0 votes
0 answers
9 views

aws-lambda-router not being included in package.json

I have a NX repo with an application called firmware-config. The build trigger is as follows: "build": { "executor": "@nx/esbuild:esbuild", "outputs"...
Utahcon's user avatar
0 votes
0 answers
122 views

Typescript globalThis for browser and Node.js: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature

I've got a Typescript 5.2.x / Node.js 18.12.x / ESM-based application that is both a website and a CLI with shared business logic. I'm having issues with declaring global types in a way where they ...
mainframenzo's user avatar
0 votes
0 answers
57 views

esbuild bundle html css js into a single file

i have a directory named src with 3 files: index.html index.js index.css this is how my html file looks like what esbuild recommends <!doctype html> <html> <head> <link ...
Mr.'s user avatar
  • 9,612
1 vote
1 answer
53 views

How can I catch esbuild's build error and run a script?

Is there a way to catch esbuild's build error and run a script? I'm using it with npm, VSCode, and vanilla JS. I can't find any documentation about it.
dllb's user avatar
  • 77
0 votes
0 answers
25 views

How can I be notified with a sound whenever esbuild fails to build due to errors in source?

I always setup esbuild to watch for changes and rebuild automatically, but I'm not notified when build fails due to source errors that I've missed, other than the console which is minimized under the ...
dllb's user avatar
  • 77
0 votes
0 answers
6 views

Does "--loader js=jsx" disable js for the build script command in package.json

If I'm adding --loader .js=jsx to my build script command in package.json will it disable all of my ordinary javascript files with js extension
Cindy's user avatar
  • 9
0 votes
0 answers
35 views

How to prevent warning `warning: Define "process.env.NODE_ENV" when bundling for the browser` with `esbuild-wasm`?

I use esbuild-wasm to transpile and bundle React code directly in the browser. Everything works except I get these warning: warning: Define "process.env.NODE_ENV" when bundling for the ...
land's user avatar
  • 53
0 votes
0 answers
47 views

Reducing Package Size in Serverless Project Monorepo using Prisma and AWS Lambda, serverless-esbuild

I'm working on a serverless project in a monorepo and encountering an issue related to the package size. For my prisma to integrate effectively with AWS lambda function, I have to include two key ...
James Arnott's user avatar
0 votes
0 answers
13 views

esbuild + typescript double IIFE

I am using esbuild to compile and minify typescript script files that will be served to browsers. I have a single source directory that holds all my source files, that will then be compiled and served ...
Egge's user avatar
  • 421
0 votes
2 answers
58 views

esbuild: when importing a js file that has jquery as a dependancy, console returns "jQuery is not defined"

When using esbuild, I can import jQuery into my bundle. After I have imported jQuery I can call it's functions. However, if I also import a file that has jQuery as a dependancy, then once my page ...
bob's user avatar
  • 793
0 votes
0 answers
252 views

Include external ES modules in the bundle

I'm getting an error when running esbuild complaining: You can mark the path "hiom" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in ...
Jan Vladimir Mostert's user avatar
0 votes
0 answers
46 views

Chrome extension publishing review process for an extension built using a js module bundler

I want to know if anyone has successfully published a chrome extension built in React or more specifically using a js module bundler like webpack. I am asking this mostly because of the review process ...
Anibal Palomo's user avatar
0 votes
2 answers
943 views

Error: Failed to scan for dependencies from entries Vite and react

I am trying to create a react app with vite and I am getting this error: Error: Failed to scan for dependencies from entries: C:/Users/User/Desktop/responsive-app/index.html The path to my project, ...
Issa's user avatar
  • 161
0 votes
2 answers
234 views

How to add esbuild plugins in AWS SAM's template.yaml?

I am currently using the AWS Serverless Application Model (SAM) to manage my TypeScript Lambda functions, and I rely on esbuild for the build process. I'd like to use esbuild plugins in my build ...
Thomas Reichmann's user avatar
1 vote
1 answer
122 views

SAM with esbuild mjs file failing with Dynamic require of "net" is not supported

I am using a SAM application and the lambda imports many libraries. I have a requirement to use await outside the handler for performance reasons. To support that, I used Metadata: ...
Linoy's user avatar
  • 1,375
2 votes
0 answers
39 views

AdminJS Fastify Integration with Mongoose - "NoResourceAdapterError"

I am trying to integrate AdminJS with Fastify and Mongoose in my Node.js application, but I am facing an issue with the "NoResourceAdapterError." Here's my code: app.ts import AdminJSFastify ...
Kundan Prasad's user avatar
1 vote
0 answers
119 views

How to Add Node Loader in Serverless ESBuild to Resolve ".node" Files Error?

I'm currently working on a serverless project where I'm using ESBuild to bundle my JavaScript code for AWS Lambda functions. Everything has been working smoothly so far, but I've run into a situation ...
Rich's user avatar
  • 4,028
0 votes
0 answers
92 views

How to use Async Server Component with honojs?

const app = new Hono() const AsyncCommponent = async () => { await new Promise((resolve) => setTimeout(resolve, 1000)); return <h1>Hello from async</h1>; } app.get('/', (c) => ...
RuslanGlaznyov's user avatar
0 votes
1 answer
85 views

How do you bundle a React app to be consumed by a legacy web app that doesn't use a bundler

I have a legacy MVC app that I would like to add React components to piece-meal. The MVC app runs without any bundler and just old-school script includes, however we only support the latest browsers. ...
Ian's user avatar
  • 4,259
0 votes
1 answer
87 views

prettier "createRequire" The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined

I am using prettier programmatically, in code, with the format(jsCodeString) function. The code works locally, but when I bundle it with esbuild, in production prettier fails when it tries to ...
Sergio Herrero's user avatar
1 vote
1 answer
141 views

Svelte + EsBuild + Deno - Uncaught TypeError: Cannot read properties of undefined (reading '$$')

I am using Deno and I am getting this error in the browser: Uncaught TypeError: Cannot read properties of undefined (reading '$$') This is bunder.ts: import * as esbuild from 'https://deno.land/x/...
tsaxking's user avatar
0 votes
0 answers
350 views

Transforming JavaScript decorators to the configured target environment ("node16") is not supported yet

I am getting this error in my aws serverless nodejs(v16.20) application, when I run this project using serverless offline command sls offline -s local. This error is generating from esbuild. I am ...
Harpreet Singh's user avatar
0 votes
0 answers
79 views

How to modify build output in esbuild `onEnd` callback?

I am working on a plugin - https://github.com/mayank1513/esbuild-plugin-react18. It works well with tsup - example. However, I when I am trying to test, I am getting outputFiles as undefined. Here's ...
Mayank Kumar Chaudhari's user avatar
1 vote
0 answers
59 views

Is there a way to tree shake out a function called in a class method?

Let's consider this code : class Foo { type; constructor(type) { this.type = type; } foo() { this.type === 'animation' ? create() : createNoop(); } } new Foo('animation') ...
Matthieu Riegler's user avatar
1 vote
1 answer
237 views

When synth or deploy with AWS CDK getting bundling error related to knex

I am using only the mssql client. But I am getting below bundling errors when I try to run cdk synth. Node.js - v18.16.0 CDK - 2.95.1 knex - 2.5.1 dirname /.../my-repo/cdk/my-app/lib/lambda Bundling ...
Shanika Ediriweera's user avatar
0 votes
2 answers
108 views

How to remove module.exports with esbuild to prevent "module is not defined" error in browser?

I have a simple JavaScript class I run tests against with Jest. Here's a greatly simplified version of it. class MyFormatter { formatText(str){ return 'foo ' + str } } module.exports = ...
Chris Barr's user avatar
  • 31.5k
0 votes
1 answer
497 views

Prevent Vite.js from renaming javascript variables (keep originally declared variable names)

I'm looking to get Vite.js to not rename javascript variable names because I'm referencing these in my HTML DOM via Alpine-js. I understand that this is inherently part of the Vite's build method. One ...
Sambuxc's user avatar
  • 437

1
2 3 4 5
8