Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

can't resolve local files without a '.js' extension #26

@vdegenne

Description

@vdegenne

Today I am trying out koa and this middleware which is nice for quickly creating projects using web components that uses es-module imports.

One problem I identified is the middleware is not able to resolve local files without a '.js' extension.
I am using mwc-dialog and mwc-button in my project and when I start the server and try to load the page I have a lot of missing scripts. Here's a capture :

I think the problem is koa-node-resolve thinks these local files are in the node_modules folder.

In the following capture :

There are three things to notice :

  • the red circle on the right clearly shows that the filepath is missing an extension
  • the red circle on the left clearly shows that the filepath is local (and maybe this middleware can use this information to treat it as is.)
  • the third thing to notice is the weirdness in the way this middleware is using both slashes, back and double backslashes in the resolved paths.

Now I don't know if this is because I am using Windows and If the problem occurs only when the middleware is run on this system, but I am really hoping you will fix this issue anytime soon.
It's either something to fix in this middleware or constraining the Polymer team to use the .js extension everytime they try to import a local script.

Thanks in advance for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions