alpine-collective / alpine-collective/alpinejs-devtools

Devtools blocks importmap from working

Open
#464 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
596
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Sometimes, usually when loading a page from the "new tab" page, I get errors in my JavaScript and my page won't load.

I see:

Import maps are not allowed after a module load or preload has started.
Uncaught TypeError: The specifier “es-toolkit” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

This only happens on the first load. If I hit reload, then everything is fine. I'm not 100% sure this extension is the issue, but when I disabled it, I couldn't make the issue happen.

Device information (please complete the following information):

  • OS: Fedora 43 + KDE
  • Browser Zen 1.18.5b (Firefox 147.0.3)
  • Extension version 2.7.4
  • Alpine.js version 3.15.8

Code sample

<script type="importmap">
    {
        "imports": {
            "es-toolkit": "https://cdn.jsdelivr.net/npm/es-toolkit@1.44/+esm",
            "handlebars": "https://cdn.jsdelivr.net/npm/handlebars@4/runtime.js/+esm"
        }
    }
</script>
<script type="module">
    import { toMerged } from 'es-toolkit';
    
    // Code using `toMerged()`
</script>

To Reproduce
Steps to reproduce the behavior:

  1. Open my website from the bookmarks bar on the new tab page
  2. See that the page isn't loaded correctly
  3. See errors in the console
  4. On a reload, everything is fine

Expected behavior
The alpine devtools doesn't crash my page

Additional context
I don't know why the alpine devtools seems to be causing this issue, but with the extension disabled I never get the issue.

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

No source file or test is named. Start by reproducing the first-load failure from the new tab page with the Alpine DevTools extension enabled, then compare the page and console behavior with the extension disabled or after reload. Done means the import map works on the initial load without the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.