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

Warn/error on unspecified external modules #31

Closed
Rich-Harris opened this issue Jan 3, 2015 · 2 comments
Closed

Warn/error on unspecified external modules #31

Rich-Harris opened this issue Jan 3, 2015 · 2 comments

Comments

@Rich-Harris
Copy link
Contributor

At present, any imported modules that can't be found relative to base are assumed to be external. I kind of like that behaviour, but it is a footgun - it might be better if you had to explicitly say which modules are external:

esperanto.bundle({
  base: 'src',
  entry: 'main',
  external: [ 'fs', 'assert' ]
}).then(...);

Only real question is whether Esperanto should throw an error or just console.warn() if it encounters an external module that wasn't specified.

@Rich-Harris
Copy link
Contributor Author

A related issue: esperantojs/gobble-esperanto-bundle#1. Sometimes, when moving files around, modules are assumed incorrectly to be external because the relative paths no longer resolve to the right place.

Some thoughts:

  • Relative paths should never be treated as external. If they can't be found, it's an error. Simples
  • When a module can't be found, the error message should include information about the importer as well as the importee, because otherwise it's hard to debug
  • rollup does this properly, and insists on an array of pre-approved external module IDs. It's much nicer

@Rich-Harris
Copy link
Contributor Author

Closing as wontfix, per #191. Rollup (with the default resolver) expects external modules to be specified explicitly, and will error if it can't find a module with a relative path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant