从angular2 Rc.5转到Final后刚刚开始遇到此错误。我不知道是什么导致了它,但我认为它来自angular2-mdl包。如果有人可以帮助我,我会很高兴。
以下是完整的错误消息:
Uncaught Error: Unexpected value 'MdlModule' imported by the module 'AppModule'
这是我的包裹:
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"@angular2-mdl-ext/popover": "0.0.3",
"@angular2-mdl-ext/select": "0.0.2",
"angular2-jwt": "^0.1.23",
"angular2-mdl": "1.7.1",
"core-js": "^2.4.1",
"es6-shim": "^0.35.0",
"es7-reflect-metadata": "^1.6.0",
"jwt-decode": "^2.0.1",
"material-design-icons": "^3.0.1",
"material-design-lite": "^1.2.1",
"rxjs": "^5.0.0-beta.12",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@angularclass/hmr": "^1.0.1",
"@angularclass/hmr-loader": "^1.0.0",
"angular2-template-loader": "^0.4.0",
"css-loader": "^0.23.1",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1",
"favicons-webpack-plugin": "0.0.7",
"file-loader": "^0.8.5",
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.15.0",
"imports-loader": "^0.6.5",
"jasmine-core": "^2.4.1",
"json-loader": "^0.5.4",
"karma": "^0.13.22",
"karma-jasmine": "^0.3.8",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.7",
"raw-loader": "^0.5.1",
"sass-loader": "^4.0.0",
"style-loader": "^0.13.1",
"ts-loader": "^0.8.1",
"tslint": "^3.5.0",
"tslint-loader": "^2.1.3",
"typedoc": "^0.4.4",
"typescript": "^2.0.2",
"typings": "^1.0.4",
"webpack": "^1.13.2",
"webpack-dashboard": "^0.1.8",
"webpack-dev-server": "^1.15.1",
"webpack-merge": "^0.14.1",
"webpack-node-externals": "^1.4.3"
}
我的构建和开发系统是:" webpack":" 1.13.2"
答案 0 :(得分:1)
将webpack升级到v2并依赖其依赖项并包含awesome-typescript-loader来处理webpack.config中的ts文件后,错误消失了,现在一切似乎都正常了。
将webpack升级到v2
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"webpack": "^2.1.0-beta.22",
"webpack-dev-server": "^2.1.0-beta.4",
包含awesome-typescript-loader来处理ts文件
loaders: [
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader']
},
...
]