WARNING in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 雖然可以忽視它,但把 WARNING 忽視並不是好的做法,本篇將介紹如何修復 Webpack 打包出現的此警告。
Angular 4
在 Angular 4 用 Webpack 打包遇到警告訊息如下:
1 2 3 4 5 6 7 8 9 10 11
WARNING in ./~/@angular/core/@angular/core.es5.js 5870:15-36 Critical dependency: the request of a dependency is an expression at ImportContextDependency.getWarnings (*****\node_modules\webpack\lib\dependencies\ImportContextDependency.js:28:4) at Compilation.reportDependencyErrorsAndWarnings (*****\node_modules\webpack\lib\Compilation.js:663:24) at Compilation.finish (*****\node_modules\webpack\lib\Compilation.js:526:9) at *****\node_modules\webpack\lib\Compiler.js:472:16 at *****\node_modules\tapable\lib\Tapable.js:225:11 at *****\node_modules\webpack\lib\Compilation.js:472:11 at *****\node_modules\webpack\lib\Compilation.js:443:13 at nextTickCallbackWith0Args (node.js:452:9) at process._tickCallback (node.js:381:13)
WARNING in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 45:15-36 Critical dependency: the request of a dependency is an expression at ImportLazyContextDependency.getWarnings (*****\node_modules\webpack\lib\dependencies\ImportContextDependency.js:28:4) at Compilation.reportDependencyErrorsAndWarnings (*****\node_modules\webpack\lib\Compilation.js:672:24) at Compilation.finish (*****\node_modules\webpack\lib\Compilation.js:535:9) at *****\node_modules\webpack\lib\Compiler.js:491:16 at *****\node_modules\tapable\lib\Tapable.js:289:11 at _addModuleChain (*****\node_modules\webpack\lib\Compilation.js:481:11) at processModuleDependencies.err (*****\node_modules\webpack\lib\dependencies\ImportContextDepedency.js:28:4)