Skip to content

fix: resolve ember-raf-scheduler to its ESM addon source for the lots-of-data demo#180

Merged
NullVoxPopuli merged 2 commits intomainfrom
copilot/fix-lots-of-data-page
Feb 25, 2026
Merged

fix: resolve ember-raf-scheduler to its ESM addon source for the lots-of-data demo#180
NullVoxPopuli merged 2 commits intomainfrom
copilot/fix-lots-of-data-page

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

/3-demos/lots-of-data crashed with [object Object] because Vite's pre-bundler couldn't correctly handle ember-raf-scheduler v0.3 (a v1 Ember addon).

What broke

@html-next/vertical-collection v5 imports { Token, scheduler } from ember-raf-scheduler, but that package's root index.js is a bare CJS ember-addon shim — no ESM exports. Vite wraps it with __commonJS and mistranslates the inner require('./package') call as window.require('./package'), which doesn't exist in the browser.

Fix

Added a resolve.alias in docs-app/vite.config.js pointing ember-raf-scheduler at its addon/index.js, which is proper ESM and exports Token and scheduler as expected. The path is resolved dynamically relative to where pnpm installs @html-next/vertical-collection, so it's not hardcoded.

const vcMain = _require.resolve('@html-next/vertical-collection');
const vcNodeModules = path.dirname(path.dirname(path.dirname(path.dirname(vcMain))));
const emberRafSchedulerAddon = path.join(vcNodeModules, 'ember-raf-scheduler', 'addon', 'index.js');

// in defineConfig:
resolve: {
  alias: { 'ember-raf-scheduler': emberRafSchedulerAddon },
}

Result

The page now renders the live DBMon benchmark with FPS counter and a virtualized 200-row table updating at requestAnimationFrame speed.

lots-of-data fixed


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…page

ember-raf-scheduler v0.3 is a v1 Ember addon that only ships a CJS
ember-addon index.js with no proper ESM exports. When vite pre-bundles
@html-next/vertical-collection, it wraps the CJS file using __commonJS
but incorrectly transforms `require('./package')` into
`window.require('./package')`, which fails in the browser with
"TypeError: window.require is not a function".

The actual ESM exports (Token, scheduler) that @html-next/vertical-collection
needs live in ember-raf-scheduler's addon/index.js. Adding a vite alias
redirects all ember-raf-scheduler imports to that file so vite correctly
pre-bundles it as proper ESM.

Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lots of data page in docs app fix: resolve ember-raf-scheduler to its ESM addon source for the lots-of-data demo Feb 25, 2026
Copilot AI requested a review from NullVoxPopuli February 25, 2026 14:38
@github-actions
Copy link
Contributor

Project Preview URL
Docs https://65e9ce1a.ue-table.pages.dev

Logs

@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review February 25, 2026 15:23
@NullVoxPopuli NullVoxPopuli merged commit 8f8085a into main Feb 25, 2026
13 checks passed
@NullVoxPopuli NullVoxPopuli deleted the copilot/fix-lots-of-data-page branch February 25, 2026 15:23
@github-actions github-actions bot mentioned this pull request Feb 25, 2026
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.

2 participants