question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove `System.import()` usage in favor of `import()`

See original GitHub issue

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:

https://github.com/angular/angular/blob/3bcc0e6f765f86ce96dbb33edf4ba0cbc53b3322/packages/core/src/linker/system_js_ng_module_factory_loader.ts#L67-L70

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 https://github.com/webpack/webpack/pull/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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:89
  • Comments:45 (14 by maintainers)

github_iconTop GitHub Comments

41reactions
PKiefcommented, Oct 27, 2018

I use a parser rule in my webpack configuration to disable the warning:

{
    // Mark files inside `@angular/core` as using SystemJS style dynamic imports.
    // Removing this will cause deprecation warnings to appear.
    test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
    parser: { system: true },  // enable SystemJS
}

https://webpack.js.org/configuration/module/#rule-parser

31reactions
psrebrnycommented, Feb 6, 2019

In Angular 7 this warning wan’t resolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - System.import is deprecated in webpack2 in favor of ...
Show activity on this post. I am working on a project in Angular 4 with Webpack 2. According to this: https://webpack.js.org/guides/code- ...
Read more >
5. The import system — Python 3.11.1 documentation
Python code in one module gains access to the code in another module by the process of importing it. The import statement is...
Read more >
import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >
Python import: Advanced Techniques and Tips
In this tutorial, you'll learn how to: Use modules, packages, and namespace packages; Handle resources and data files inside your packages; Import modules ......
Read more >
Imports Statement - .NET Namespace and Type - Visual Basic
An import alias or name by which code can refer to namespace instead of the full ... Public Function GetFolders() As String '...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found