请帮助我使用netcoreapp2.0角度4.4.5,角度材料2.0.0-beta.12和angular-cdk 2.0.0-beta.12 . 所有角度材料模块在应用程序的开发中都能很好地工作,但每当我尝试发布应用程序时,我都会收到错误 .
app.module.shared.ts:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './components/app/app.component';
import { NavMenuComponent } from './components/navmenu/navmenu.component';
import { HomeComponent } from './components/home/home.component';
import { FetchDataComponent } from './components/fetchdata/fetchdata.component';
import { CounterComponent } from './components/counter/counter.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule, MatCheckboxModule } from '@angular/material';
import 'hammerjs';
@NgModule({
declarations: [
AppComponent,
NavMenuComponent,
CounterComponent,
FetchDataComponent,
HomeComponent
],
imports: [
CommonModule,
HttpModule,
FormsModule,
BrowserAnimationsModule,
MatButtonModule, MatCheckboxModule,
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'counter', component: CounterComponent },
{ path: 'fetch-data', component: FetchDataComponent },
{ path: '**', redirectTo: 'home' }
])
]
})
export class AppModuleShared {}
Error message:
ERROR in ng:///C:/Users/dlord/repo/myapp/node_modules/@angular/material/progress-spinner/typings/index.d.ts.MatProgressSpinner_Host.html (2,1):
Property 'DOCUMENT' does not exist on type 'typeof "C:/Users/dlord/repo/myapp/node_modules/@angular/common/common"'.
ERROR in ng:///C:/Users/dlord/repo/myapp/node_modules/@angular/material/progress-spinner/typings/index.d.ts.MatSpinner_Host.html (2,1):
Property 'DOCUMENT' does not exist on type 'typeof "C:/Users/dlord/repo/myapp/node_modules/@angular/common/common"'.
ERROR in ./$$_gendir/~/@angular/material/button/typings/index.ngfactory.ts
Module parse failed: C:\Users\dlord\repo\myapp\$$_gendir\node_modules\@angular\material\button\typings\index.ngfactory.ts Unexpected token (17:37)
You may need an appropriate loader to handle this file type.
| import * as i6 from '@angular/cdk/a11y';
| import * as i7 from '@angular/material/core';
| export const MatButtonModuleNgFactory:i0.NgModuleFactory<i1.MatButtonModule> = i0.╔╡cmf(i1.MatButtonModule,
| ([] as any[]),(_l:any) => {
| return i0.╔╡mod([i0.╔╡mpd(512,i0.ComponentFactoryResolver,i0.╔╡CodegenComponentFactoryResolver,
@ ./$$_gendir/ClientApp/app/components/home/home.component.ngfactory.ts 8:0-109
@ ./$$_gendir/ClientApp/app/app.module.server.ngfactory.ts
@ ./ClientApp/boot.server.ts
C:\Users\dlord\repo\myapp.csproj(46,5): error MSB3073: The command "node node_modules/webpack/bin/webpack.js --env.prod" exited with code 2.