11ty / 11ty/webc

Add `webc:bundler` abstraction for user to handle bundling themselves using their own bundler

Open
#93 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
1.4k
Forks
46
Avg merge
10m
Merged PRs (30d)
2

Description

Tried to make a customTransform called esbuild to transform esm javascript that imports node modules and local modules

src
- page.webc
- live-reload.js
- diagrams.js

src/page.webc

<script webc:type="esbuild" src="./live-reload.js"></script>

src/diagrams.js

import mermaid from 'mermaid' // or any other installed node_module
/* magic */
export default {}

src/live-reload.js

import diagrams from './diagrams.js'

/* code that uses diagrams */

Looks like a common enough use case. I don't think customTransforms were made for this. And transforms are not sufficient for this since get the content and not the src paths. And they are executed once per node, instead of once per compilation

Feels like we need a similar abstraction for bundled assets which operate on src paths

<script webc:bundler="esbuild" src="./live-reload.js"></script>

Thoughts?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing customTransform behavior and the compilation lifecycle, focusing on how transforms receive content and are invoked per node. Compare that with the proposed webc:bundler attribute and its src-path-based, per-compilation behavior; done means the abstraction and its expected user-facing behavior are defined and supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.