gpt4 book ai didi

webpack - 无法使用 Webpack 构建 Angular 4 示例

转载 作者:太空狗 更新时间:2023-10-29 17:33:03 25 4
gpt4 key购买 nike

我最近安装了 Angular 4 (RC2) 并从简单的 Quickstart example 复制了文件.但是,当我尝试使用 Webpack 构建项目时,出现错误,指出 Rxjs 无法解析:

WARNING in ~/@angular/core/@angular/core.es5.js
6857:19-40 Critical dependency: the request of a dependency is an expression

WARNING in ~/@angular/core/@angular/core.es5.js
6883:19-106 Critical dependency: the request of a dependency is an expression

ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/Subject' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 26:0-39
@ ./app/app.module.ts
@ ./main.ts

ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/observable/merge' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 23:0-46
@ ./app/app.module.ts
@ ./main.ts

ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/operator/share' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 24:0-44
@ ./app/app.module.ts
@ ./main.ts

ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/symbol/observable' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 25:0-54
@ ./app/app.module.ts
@ ./main.ts

ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/Observable' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 22:0-45
@ ./app/app.module.ts
@ ./main.ts

我已经安装了 Rxjs 5.0.1,我认为这是 Angular 期望的版本。我想不出还有什么可做的。

最佳答案


新的上下文替换插件(
/Angular (\\|\/)核心(\\|\/)@ Angular/,
path.resolve(__dirname, '../src')
)
适用于 webpack.common.js 中的 webpack

关于webpack - 无法使用 Webpack 构建 Angular 4 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42557614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com