Skip to content

Remove System.import() usage in favor of import() #21560

Closed
@filipesilva

Description

@filipesilva

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Currently Angular core makes use of a System.import() call to load templates (html/css) and lazy modules:

return System.import(module)
.then((module: any) => module[exportName])
.then((type: any) => checkNotEmpty(type, module, exportName))
.then((type: any) => this._compiler.compileModuleAsync(type));

In the past System.import was expected to become a standard, but import() was settled upon instead.

Modern tooling is beginning to deprecate (notably Webpack 4 webpack/webpack#6321) System.import() detection in favor of the standard and it should not be unexpected that more follow suit.

Expected behavior

The standard import() is used, so that tooling that supports code splitting can detect it.

Minimal reproduction of the problem with instructions

The SystemJS loader can be found at https://github.com/angular/angular/blob/master/packages/core/src/linker/system_js_ng_module_factory_loader.ts.

What is the motivation / use case for changing the behavior?

Remain compatible with modern tooling.

Environment


Angular version: 2, 4 and 5

/cc @hansl @bradlygreen @IgorMinar @robwormald

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: coreIssues related to the framework runtimefeatureIssue that requests a new feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions