加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用webpack构建angular2应用程序 – 找不到./compiler.es5.ts

发布时间:2020-12-17 08:53:23 所属栏目:安全 来源:网络整理
导读:我正在使用webpack构建一个angular2应用程序.将angular2从2.3.1升级到4.0.1后,webpack输出以下警告: WARNING in ./~/@angular/compiler/@angular/compiler.es5.jsCannot find source file 'compiler.es5.ts': Error: Can't resolve './compiler.es5.ts' in
我正在使用webpack构建一个angular2应用程序.将angular2从2.3.1升级到4.0.1后,webpack输出以下警告:
WARNING in ./~/@angular/compiler/@angular/compiler.es5.js
Cannot find source file 'compiler.es5.ts': Error: Can't resolve 
'./compiler.es5.ts' in '../node_modules@angularcompiler@angular'
@ ./~/@angular/platform-browser-dynamic/@angular/platform-browser-dynamic.es5.js 11:0-72

消息是正确的,因为在该位置没有这样的带有ts扩展名的文件,该文件存在但具有js扩展名.

我是否错过了webpack配置值?

顺便说一句:如果我使用@ angular / cli v1.0构建应用程序,我看不到警告.

报道了类似的问题
https://github.com/angular-redux/store/issues/64

解决方法是在webpack.config.js中为source-map-loader添加排除规则.

{
        test: /.(js|ts)$/,exclude: [
            // workaround for this issue
            path.join(__dirname,'node_modules','@angular/compiler')
        ],use: [{
            loader: 'source-map-loader'
        }],enforce: 'pre'
}

但上面的解决方案只不过是暂时的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读