Angular出现“Critical dependency: the request of a dependency is an expression”的警告

问题:Angular出现“Critical dependency: the request of a dependency is an expression”的警告

WARNING in ./~/@angular/core/@angular/core.es5.js Critical dependency: the request of a dependency is an expression 图例:

解决办法:

       new webpack.ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
            utils.root('./src'), {}
        ),
复制代码

改为:

        new webpack.ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)@angular/,
            utils.root('./src'), {}
        ),
复制代码

上面的util是定制化的工具类,这个可以不用关注,只需要替代/angular(\|/)core(\|/)@angular/,就行

参考: Getting a warning in console when compiling Angular 4 rc 2 #14898

你可能感兴趣的:(Angular出现“Critical dependency: the request of a dependency is an expression”的警告)