Ionic-framework: NgModuleLoader not Webpack-friendly

Created on 7 Jul 2017  路  7Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When trying to build a Angular app using ionic-angular without the Ionic CLI but with webpack (using angular-cli for example), this warnings appear during build:

WARNING in ./~/ionic-angular/util/ng-module-loader.js
54:11-36 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ionic-angular/util/ng-module-loader.js
69:11-36 Critical dependency: the request of a dependency is an expression

These are due to the dynamic System.import() making Webpack unable to alias properly the files to import statically.

Expected behavior:
It should build without warnings.

Steps to reproduce:
Create a new project with angular-cli, then npm install -S ionic-angular and include ionic-angular modules in app.module.ts.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

[WARN] You are not in an Ionic project directory. Project context may be missing.

global packages:

    @ionic/cli-plugin-proxy : 1.3.1
    @ionic/cli-utils        : 1.4.0
    Ionic CLI               : 3.4.0

System:

    Node       : v7.9.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.2.1 Build version 8C1002 
    ios-deploy : 1.9.0 
    ios-sim    : 5.0.4 
    npm        : 4.2.0 

All 7 comments

Hello! Thanks for opening an issue with us! As this seems like more of a support question I will urge that you ask this question on our forum or on our slack channel. Thanks for using Ionic!

@jgw96 This is not a support question but indeed a bug report.
According to the source of the issue (ie webpack): https://github.com/webpack/webpack/issues/196 which explains why this warning is emitted, there is no other way to fix this warning other than fixing the library causing this.

After investigation and according to the docs, this can be resolved with require context.

@jgw96 Are you open to a PR on this?

@sinedied I am facing same issue. Can you please explain what you did to fix the issue in detail what you mean by "resolved with require context"

I did not fix the issue and went with the (harmless) warning since I want to keep a vanilla angular-cli setup. However if you eject your webpack configuration, you can either ignore it or use a require context setup to silence the warning.

Same issu.. hope @ionic-team will fix it soon as possible to realy enable Ionic UI on a simple standard Angular CLI project.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SebastianGiro picture SebastianGiro  路  3Comments

aslamj picture aslamj  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments

MrBokeh picture MrBokeh  路  3Comments

brandyscarney picture brandyscarney  路  3Comments