Skip to content

feat(less5): dev browser bundle (dist/less-browser-dev.js) - #4516

Merged
matthew-dean merged 1 commit into
less:alphafrom
matthew-dean:feat/browser-v5-bundle
Sep 2, 2026
Merged

matthew-dean merged 1 commit into
less:alphafrom
matthew-dean:feat/browser-v5-bundle

Conversation

@matthew-dean

Copy link
Copy Markdown
Member

What

Ships a single-file browser build of Less v5 (jess) as dist/less-browser-dev.js — an esbuild IIFE exposing global lessV5 with .render / .renderString. A thin entry drives @jesscss/compiler renderToResult with inline source and no filePath, so the Node config-discovery layer never runs; Node file/config built-ins (fs/module/url/cosmiconfig) are aliased to browser stubs, path → path-browserify.

Not an advertised production feature

Per owner decision, this is an opt-in dev file loaded only by explicit path:

  • Baked-in banner (esbuild banner:js, survives minify) leads the file:

    /*! Less v5 (alpha) browser build. For live styling in the browser, follow the Less browser guide. Compiling Less in the browser is not intended for production — compile ahead of time (Node "less") for production builds. */

  • package.json browser / unpkg / jsdelivr / module are intentionally not set, and there is no ./browser export condition. less@5's primary surface stays Node-only.
  • The file rides the existing "dist" files glob into the published tarball, so a CDN can serve it by full path.

Publish flow builds it

build:browser is wired into the less package prepublishOnly (typecheck && build && build:browser && test:lessc), so the publish path (bump-and-publish.js → npm publish → prepublishOnly) produces dist/less-browser-dev.js before pack.

Once an alpha publishes, the file is served at:

https://cdn.jsdelivr.net/npm/less@<version>/dist/less-browser-dev.js

Verification

  • Rebased onto alpha @ jess @jesscss/core@2.0.0-alpha.15; rebuilt clean (2.70 MB).
  • Browser bundle smoke-tested against alpha.15: renderString(".a{ .b{color:red} }") compiles to nested CSS (v5 collapseNesting:false default); parse errors surface.
  • dist/ is gitignored; the artifact is produced at prepublishOnly, not committed.
  • Additive only — new browser entry + stubs + package.json/lockfile; the Node CLI path is unchanged.

Add a single-file browser build of Less v5 (jess): a thin entry that drives
@jesscss/compiler renderToResult with inline source and no filePath, so the
Node config-discovery layer never runs. esbuild IIFE (global lessV5) bundles
the pure-JS runtime parseman and aliases Node file/config built-ins
(fs/module/url/cosmiconfig) to browser stubs; path -> path-browserify.

Shipped as an OPT-IN dev artifact only, loaded by explicit path:
- output is dist/less-browser-dev.js with a baked-in banner marking it an
  experimental browser build not intended for production;
- package.json browser/unpkg/jsdelivr/module and the ./browser export
  condition are intentionally NOT set, so less@5's primary surface stays
  Node-only;
- dist/less-browser-dev.js rides the existing "dist" files glob into the
  published tarball so a CDN can serve it by full path;
- build:browser is wired into prepublishOnly so the publish flow builds it.

Validated in-browser: compiles Less->CSS and surfaces parse errors.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 9591b978-a116-4998-bb6c-8c63f5b83628

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

Adds an opt-in Less v5 development browser bundle powered by Jess and includes it in the package publication build.

  • Adds a browser API exposing render, renderString, Compiler, and version information.
  • Adds browser substitutes for Node filesystem, module, URL, path, and configuration dependencies.
  • Adds an esbuild-based IIFE build with an alpha-use banner and lessV5 browser global.
  • Runs the new browser build during prepublishOnly and locks the esbuild dependency.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable issue identified.

The new bundle is generated during publication, remains opt-in, uses inline source without a file path, and the investigated runtime, diagnostic, packaging, and dependency paths did not establish an observable defect.

Reviews (1): Last reviewed commit: "feat(less5): experimental dev browser bu..." | Re-trigger Greptile

@matthew-dean
matthew-dean merged commit 629aca6 into less:alpha Sep 2, 2026
11 checks passed
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.

1 participant