Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add resolvers for module named packages for offline support #1

Open
brion-fuller opened this issue May 31, 2020 · 1 comment

Comments

@brion-fuller
Copy link

Currently, module-resolver only works for a CDN like unpkg or using alias. We should give the ability to resolve module named imports to the node_modules folder.

Example

import { LitElement, html, customElement } from "lit-element";

@customElement("hello-world")
export default class HelloWorld extends LitElement {
  render() {
    return html`<h1>Hello World</h1>`;
  }
}

This could resolve to the /base/node_modules/lit-element/lit-element.js

@l1bbcsg
Copy link
Contributor

l1bbcsg commented Jun 2, 2020

Sounds fair.
I believe we didn't think about it because ECMAScrript modules support in node is still experimental and we tried to use production version of dependencies, therefore avoiding exporting from node_modules.
I don't see why it can't be added as an option to the preprocessor though.

It's probably pretty trivial to implement with require.resolve too.

One thing that may go wrong is that Karma will need to serve files from node_modules and those files may be anywhere in the filesystem, potentially even above Karma/project roots (think global installations) and this might get weird because of the way it does absolute paths.

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

No branches or pull requests

2 participants