lukeed / lukeed/dimport

Dynamically importing relative paths

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

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
546
Forks
5
PR merge metrics
No merged PRs in 30d

Description

In comparing the dimport legacy importer with Chrome's native importer, I am noticing a discrepancy in how paths are resolved.

In chrome, I see the following happening...

Given the following structure:
/index.html
/foo/main.js
/foo/dynamic-component.js

if /foo/main.js has the following code
```
import('./dynamic-component.js');
```
Chrome loads the file fine. When testing in Firefox using the legacy importer it is looking for the file in /dynamic-component.js instead of /foo/dynamic-component.js and 404s. I haven't tested the module/nomodule versions to see if there is any difference with them.

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

Reproduce the example with /index.html, /foo/main.js, and /foo/dynamic-component.js using the dimport legacy importer in Firefox, then compare it with Chrome's native importer. Trace how the legacy importer resolves import('./dynamic-component.js'); done means it requests /foo/dynamic-component.js rather than /dynamic-component.js.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.