首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular 5 -- webpack问题

Angular 5 -- webpack问题
EN

Stack Overflow用户
提问于 2017-12-05 01:02:43
回答 0查看 227关注 0票数 0

我在win x-64机器上有以下设置:

代码语言:javascript
复制
_                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
/ ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
|___/

Angular CLI: 1.5.5
Node: 9.2.0
OS: win32 x64
Angular: 5.0.4
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cdk: 5.0.0-rc.2
@angular/cli: 1.5.5
@angular/material: 5.0.0-rc.2
@angular-devkit/build-optimizer: 0.0.34
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.38
@ngtools/json-schema: 1.1.0
@schematics/angular: 0.1.8
typescript: 2.4.2
webpack: 3.8.1

我得到以下错误消息:

代码语言:javascript
复制
ERROR in C:/Users/xxx/documents/proj/data-collection/src/main.ts
Module build failed: Error: C:\Users\xxx\documents\proj\data-collection\src\main.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (C:\Users\xxx\documents\proj\data-collection\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:643:23)
    at plugin.done.then (C:\Users\xxx\documents\proj\data-collection\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\loader.js:467:39)
    at <anonymous>
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in C:/Users/xxx/documents/proj/data-collection/src/polyfills.ts
Module build failed: Error: C:\Users\xxx\documents\proj\data-collection\src\polyfills.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (C:\Users\xxx\documents\proj\data-collection\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:643:23)
    at plugin.done.then (C:\Users\xxx\documents\proj\data-collection\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\loader.js:467:39)
    at <anonymous>
 @ multi ./src/polyfills.ts

这个问题也发生在非常新鲜的:ng new foo之后。

有一个很长的线程here,但我仍然没有设法找到问题的根源。我试图在@ngtools/webpack版本上胡乱操作,但这被证明是一个太大的组合问题

我的package.json文件是:

代码语言:javascript
复制
{
  "name": "data-collection",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.0.4",
    "@angular/cdk": "^5.0.0-rc.2",
    "@angular/common": "^5.0.4",
    "@angular/compiler": "^5.0.4",
    "@angular/compiler-cli": "^5.0.4",
    "@angular/core": "^5.0.4",
    "@angular/forms": "^5.0.4",
    "@angular/http": "^5.0.4",
    "@angular/material": "^5.0.0-rc.2",
    "@angular/platform-browser": "^5.0.4",
    "@angular/platform-browser-dynamic": "^5.0.4",
    "@angular/platform-server": "^5.0.4",
    "@angular/router": "^5.0.4",
    "common-tags": "^1.5.1",
    "polyfills": "^2.1.1",
    "rxjs": "^5.5.2",
    "zone": "^0.3.4"
  },
  "devDependencies": {
    "@angular/cli": "^1.5.5",
    "typescript": "^2.4.2"
  }
}
EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47638370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档