webpack:关键依赖消息 [英] webpack: Critical dependency message

查看:25
本文介绍了webpack:关键依赖消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

加载组件时出现此错误:

I'm getting this error when I load my components:

./~/@angular/core/@angular/core.es5.js5889:15-36 关键依赖:依赖的请求是一个表达式

./~/@angular/core/@angular/core.es5.js 5889:15-36 Critical dependency: the request of a dependency is an expression

任何人都可以帮忙弄清楚这是什么意思?

Anyone could help out to figure out what does it mean?

推荐答案

好的,我的问题已经解决了.也许你正在经历同样的事情.在 Angular 2.x 中我有

Ok I got my issue nailed down. Perhaps you're experiencing the same thing. In Angular 2.x I had

new webpack.ContextReplacementPlugin(
    // The (\\|\/) piece accounts for path separators in *nix and Windows
    /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
    root('./app'), // location of your src
    {} // a map of your routes
)

现在在 Angular 4.x 中它变成了...

Now in Angular 4.x it changes to...

new webpack.ContextReplacementPlugin(
        /angular(\\|\/)core(\\|\/)@angular/,
        root('./app'),
        {}
)

根据这篇文章https://github.com/angular/angular/issues/11580

这篇关于webpack:关键依赖消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆