tc39 / proposal-dynamic-import

import() proposal for JavaScript

Home Page:https://tc39.github.io/proposal-dynamic-import/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how is it work with a indirect dependencie?

robsongajunior opened this issue · comments

Imagine you have a external JavaScript module file.

import('https://host.com/path/file.js')

and the file.js have another import.
What should be the behavior?

Question

  • The main module, will be wait to the complete all internal dependencies?

Yes, just like if it was an entry point via a script tag.

How to handle dependencies like import { Component } from '@angular/core'; ?
I get TypeError: Failed to resolve module specifier "@angular/core". Relative references must start with either "/", "./", or "../"..
Though using the same (Angular) library though npm install does work.
So '@angular/core' is actually a NPM scope and refers to a installed NPM module. Though with SystemJS 6 (UMD) you can specify a resource mapping to re-use already loaded modules.
Is it possible to somehow specifying that '@angular/core' should be reused/linked to an already loaded module?
Or is there a resolve function that can be used for that matter, just like with the es6-module-loader frameworks?

@resolvethis that has nothing to do with dynamic import. Bare specifiers work fine in node; in browsers you'd need a bundler or an import map.