Skip to content

Add default asset loaders to esbuild config#249

Merged
bcomnes merged 1 commit into
masterfrom
fix/default-esbuild-loaders
Jun 27, 2026
Merged

Add default asset loaders to esbuild config#249
bcomnes merged 1 commit into
masterfrom
fix/default-esbuild-loaders

Conversation

@bcomnes

@bcomnes bcomnes commented Apr 18, 2026

Copy link
Copy Markdown
Owner

Adds default loader entries to the esbuild buildOpts so common image, icon, and font file types work out of the box when referenced from CSS or client-side bundles.

Changes

  • Adds default data URL loaders for common image formats: .png, .jpg, .jpeg, .gif, .svg, .webp, and .avif.
  • Adds default file loaders for icon and font formats: .ico, .woff, .woff2, .ttf, .eot, and .otf.
  • Adds integration coverage for CSS asset references, verifying GIF assets are inlined as data URLs and WOFF2 fonts are emitted as files.
  • Documents two esbuild.settings.* customization patterns:
    • modifying DOMStack defaults without a full reset
    • resetting DOMStack convenience defaults back toward esbuild defaults for full customization

Validation

  • npm run test:node-test -- test-cases/general-features/index.test.js

Closes #230

Copilot AI review requested due to automatic review settings April 18, 2026 18:41
@github-actions

Copy link
Copy Markdown

Coverage Report for CI Build 24611338344

Coverage increased (+0.03%) to 91.496%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: 16 of 16 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4085
Covered Lines: 3819
Line Coverage: 93.49%
Relevant Branches: 642
Covered Branches: 506
Branch Coverage: 78.82%
Branches in Coverage %: Yes
Coverage Strength: 73.44 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds default esbuild loader configuration so common asset types referenced from CSS/JS (images and fonts) build successfully without requiring a user-provided esbuild.settings.js.

Changes:

  • Adds default buildOpts.loader mappings for common image extensions using the dataurl loader.
  • Adds default buildOpts.loader mappings for common font/icon extensions using the file loader.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/build-esbuild/index.js
@bcomnes

bcomnes commented Apr 18, 2026

Copy link
Copy Markdown
Owner Author

Acknowledged comment 3105651046. Declining to add an integration fixture in this PR. Adding test assets (binary image/font files) to the repo for a build-time integration test is a meaningful scope expansion. The change itself is a straightforward esbuild loader config addition following esbuild's documented defaults; the regression risk is low since esbuild would error at build time if any configured extension failed. A proper integration fixture can be added as a follow-up when we have a pattern for binary asset fixtures in place.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bcomnes

bcomnes commented Jun 26, 2026

Copy link
Copy Markdown
Owner Author

Need to make sure we added the error that makes sense too.

Configure default esbuild loaders for common image, icon, and font file types so CSS and client bundles can reference assets without custom settings.

Add integration coverage for CSS asset imports, including inlined GIF data URLs and emitted WOFF2 font files.

Document how to extend DOMStack's esbuild defaults and how to reset convenience defaults for full customization.

Closes #230
@bcomnes bcomnes force-pushed the fix/default-esbuild-loaders branch from 09db533 to 4ad4272 Compare June 27, 2026 01:41
@bcomnes bcomnes merged commit a1e8e1c into master Jun 27, 2026
10 checks passed
@bcomnes bcomnes deleted the fix/default-esbuild-loaders branch June 27, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add default esbuild loaders for common asset types referenced in CSS

2 participants