Skip to content

Ionic 3 and Webpack 2 warning #11072

Closed
Closed

Description

Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[x] 3.0

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request

Current behavior:
Since i ve upgraded to ionic 3, i get this error in my webpack build:

WARNING in /xxx/app/~/ionic-angular/util/ng-module-loader.js
54:11-36 Critical dependency: the request of a dependency is an expression
    at ImportContextDependency.getWarnings (/xxx/app/node_modules/webpack/lib/dependencies/ImportContextDependency.js:28:4)
    at Compilation.reportDependencyErrorsAndWarnings (/xxx/app/node_modules/webpack/lib/Compilation.js:668:24)
    at Compilation.finish (/xxx/app/node_modules/webpack/lib/Compilation.js:531:9)
    at /xxx/app/node_modules/webpack/lib/Compiler.js:486:16
    at /xxx/app/node_modules/tapable/lib/Tapable.js:225:11
    at _addModuleChain (/xxx/app/node_modules/webpack/lib/Compilation.js:477:11)
    at processModuleDependencies.err (/xxx/app/node_modules/webpack/lib/Compilation.js:448:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Any idea why ?

Cheers

Activity

  1. jgw96 commented on Apr 5, 2017

    @jgw96
    Contributor

    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!

  2. marcoturi commented on Apr 11, 2017

    @marcoturi

    I run to the same issue updating ionic2-boilerplate to ionic 3 during unit testing command. It looks similar to those issues
    angular/angular#11580
    webpack/webpack#196

    I got:

    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
    

    @ghaiat Did you managed to resolve this issue ? Also could you provide a little more context about it?

  3. marcoturi commented on Apr 11, 2017

    @marcoturi

    For anyone having this issue, the fix is to add in you webpack configuration:

     new ContextReplacementPlugin(
                    /ionic-angular/,
                    path.resolve('./src'),
                    {}
                ),
    
  4. cryo243 commented on Apr 12, 2017

    @cryo243

    And together with angular 4 warnings it becomes
    new ContextReplacementPlugin( /(ionic-angular)|(angular(\\|\/)core(\\|\/)@angular)/, path.resolve('./src') , {} )

  5. maapteh commented on Apr 15, 2017

    @maapteh

    Why is this issue closed? Since version 3 i also get these warnings

    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
    

    which basically says there is a dynamic import and dynamic imports should not be used.

    Since im using angular/cli and not ionic/cli (i only like the framework for build i simply use cordova and angular cli running ng build --prod --base-href ./ --output-path www --output-hashing=none) . Can this issue be fixed on library side?

  6. schacki commented on May 3, 2017

    @schacki
  7. shanehughes3 commented on May 8, 2017

    @shanehughes3

    I'm getting this error when running karma/jasmine tests, and I don't have a webpack conf where I can add the aforementioned fix. The folks over at webpack seem to imply that this is an issue that shouldn't be suppressed, so shouldn't we be talking about a library fix?

  8. kamok commented on May 18, 2017

    @kamok

    @jgw96 Can you please reopen? I'm getting the same issue as @shanehughes3. I also don't have a webpack config and I have the problem when running karma/jasmine tests. This surfaced after upgrading to ionic 3.1.1

  9. cryo243 commented on May 18, 2017

    @cryo243

    I know this is not a final fix but both of you guys could have a different webpack config for your tests and implement the fix above(just so you can get rid of the warnings until ionic fixes it)' One issue is related to angular 4 the other one is from ionic native

  10. kamok commented on May 18, 2017

    @kamok

    @cryo243 I can't find a webpack config in my app. I don't know where it is. Is it in the node_modules/angular folder?

  11. cryo243 commented on May 18, 2017

    @cryo243

    @kamok if you are using karma/webpack to run your unit tests you should have created a webpack config.
    in your karma.conf file you should have a webpack property that points to your custom webpack test file

  12. kamok commented on May 18, 2017

    @kamok

    @cryo243 I use angular/cli. Same set up as this seeder project: https://github.com/lathonez/clicker

  13. cryo243 commented on May 19, 2017

    @cryo243

    @kamok , that's because you are using angular cli together with karma. Angular cli uses webpack in the background but I'm not sure to what extent you can customize their Webpack config.
    Rather use your own webpack config for unit tests and pass it to your karma.conf (you will need to install karma-webpack plugin though)
    then in your karma.conf file replace
    angularCli: { environment: 'dev' },
    with
    webpack: path/to/TestWebpackConfig,

  14. russcarver commented on Jun 29, 2017

    @russcarver

    Can someone post the contents of just what such a "test" webpack config should look like?

  15. tinomen commented on Sep 28, 2017

    @tinomen

    I get this warning twice. Is the current solution still to suppress them?

  16. jdnichollsc commented on Nov 3, 2017

    @jdnichollsc

    @jgw96 Any news guys? thanks in advance, it's really neccesary without eject the webpack configuration of angular to fix the issue! 👍

    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
    
  17. cryo243 commented on Nov 3, 2017

    @cryo243

    Hi guys,
    I thought I would create very basic example feel free to check https://github.com/cryo243/ionic-unit-tests

  18. jdnichollsc commented on Nov 5, 2017

    @jdnichollsc

    @jgw96 Justin, please reopen this issue. it's generated from the library because this is an incompatibility with the "ng serve" of the angular-cli.
    Thanks guys in advance! ✌️

  19. jdnichollsc commented on Nov 23, 2017

    @jdnichollsc

    @jgw96 @mlynch Any news about this item? it's very complicated? Any response from the Ionic team is really appreciated 🙏 (this would be like a Christmas gift)

  20. jdnichollsc commented on Jan 4, 2018

    @jdnichollsc

    Hi @danbucholtz, Is possible to create a new release of Ionic with the fix of the default webpack configuration with the following fix? https://github.com/ionic-team/ionic-unit-testing-example/pull/34/files
    Thanks in advance guys!

  21. jdnichollsc commented on Jan 4, 2018

    @jdnichollsc

    Guys, what do you think about the following PR? ionic-team/ionic-app-scripts#1360

  22. damsorian commented on May 23, 2018

    @damsorian

    this issue is not resolved ...

  23. jdnichollsc commented on May 24, 2018

    @jdnichollsc

    @damsorian I'm waiting for Ionic 4 due to this issue...

  24. edwinm commented on Jul 2, 2018

    @edwinm

    July 2nd 2018 and still not resolved...

    WARNING in ./node_modules/ionic-angular/es2015/util/ng-module-loader.js
    25:11-36 Critical dependency: the request of a dependency is an expression
     @ ./node_modules/ionic-angular/es2015/util/ng-module-loader.js
     @ ./node_modules/ionic-angular/es2015/util/module-loader.js
     @ ./node_modules/ionic-angular/es2015/components/modal/modal-component.js
     @ ./node_modules/ionic-angular/es2015/index.js
     @ ./src/test.ts
    
  25. ionitron-bot commented on Sep 1, 2018

    @ionitron-bot

    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.

  26. locked and limited conversation to collaborators on Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions