fix(explore): mount Ask pill via importmap for dompurify and marked#305
Merged
SimplicityGuy merged 1 commit intomainfrom Apr 15, 2026
Merged
fix(explore): mount Ask pill via importmap for dompurify and marked#305SimplicityGuy merged 1 commit intomainfrom
SimplicityGuy merged 1 commit intomainfrom
Conversation
The Ask pill never mounted in production because nlq-markdown.js uses bare module specifiers (dompurify, marked) but explore serves static files with no bundler. The browser rejected the imports with "Failed to resolve module specifier", which cascaded through the module chain (nlq.js → nlq-summary-strip.js → nlq-markdown.js) so window.NlqInit was never set and app.js's DOMContentLoaded handler found nothing to call. Vitest tests still passed because jsdom resolves from node_modules. Add an import map in index.html pointing both specifiers to pinned jsdelivr /+esm URLs (matching the existing CDN-with-version pattern), add a regression test that scans all static JS for bare specifiers and asserts each is declared in the importmap, and normalize nlq-pill.css to a relative href to match the rest of the file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Contributor
Contributor
Contributor
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nlq-markdown.jsuses bare module specifiers (dompurify,marked) but explore serves static files with no bundler, so the browser throwsFailed to resolve module specifier "dompurify". The error cascades through the module chain (nlq.js→nlq-summary-strip.js→nlq-markdown.js),window.NlqInitis never set, andapp.js'sDOMContentLoadedhandler finds nothing to call. Vitest tests passed throughout because jsdom resolves fromnode_modules.<script type="importmap">inexplore/static/index.htmlmapping both specifiers to pinnedcdn.jsdelivr.net/.../+esmURLs (matching the existing pinned-CDN pattern used for d3, plotly, and alpine).explore/__tests__/importmap-coverage.test.jsscans everystatic/js/**/*.jsfor bareimportspecifiers and asserts each one is declared in the importmap, and that the importmap appears before the first module script.nlq-pill.csshreffrom/css/nlq-pill.csstocss/nlq-pill.cssto match the file's existing relative-path convention for own static assets.Test plan
just test-js— 987 tests passing (up from 985; includes the 2 new regression tests)nlq-pill.cssstill loads correctly after the href change🤖 Generated with Claude Code