我在让样式表正常工作时遇到了一些问题。我仍然在使用Angular2,并且我下载的seed比我之前使用的seed更新,所以在这一点上,使用moduleId : module.id已经被弃用。如果没有moduleId,相对路径将不起作用,我现在必须从app文件夹开始执行完整路径。这只是我做事情的方式,还是有解决的办法?
我看过一些文章,其中一篇建议我们使用moduleId: module.id + ""来解决这个问题,因为webpack使用的是数字,而Angular使用的是字符串。当我尝试使用相对路径时,我仍然得到一个错误,告诉我css文件加载失败。
我尝试更新我的webpack和angular-animations,更新成功,但没有改变行为。我希望我能找到指向种子的链接,这样我就可以准确地显示我使用的是哪一个,但这里是package.json文件,希望这能揭示一些事情。
{
"name": "angular2-seed",
"version": "1.0.0",
"description": "A simple starter Angular2 project",
"scripts": {
"build": "rimraf dist && webpack --progress",
"watch": "npm run build -- --watch",
"server": "webpack-dev-server --inline --progress --port 3000 --content-base src",
"start": "npm run server"
},
"contributors": [
"Rob Wormald <robwormald@gmail.com>",
"PatrickJS <github@gdi2290.com>"
],
"license": "MIT",
"dependencies": {
"@angular/common": "~4.0.1",
"@angular/compiler": "~4.0.1",
"@angular/compiler-cli": "~4.0.1",
"@angular/core": "~4.0.1",
"@angular/forms": "~4.0.1",
"@angular/http": "~4.0.1",
"@angular/platform-browser": "~4.0.1",
"@angular/platform-browser-dynamic": "~4.0.1",
"@angular/platform-server": "~4.0.1",
"@angular/router": "~4.0.1",
"@angular/upgrade": "~4.0.1",
"angular-in-memory-web-api": "^0.3.1",
"core-js": "^2.4.1",
"ie-shim": "^0.1.0",
"reflect-metadata": "^0.1.9",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@types/node": "^7.0.12",
"angular2-router-loader": "^0.3.4",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^3.1.2",
"css-loader": "^0.26.0",
"html-webpack-plugin": "^2.28.0",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.4",
"to-string-loader": "^1.1.4",
"typescript": "~2.2.0",
"webpack": "^2.7.0",
"webpack-dev-server": "2.4.2",
"webpack-merge": "^4.1.0"
},
"keywords": [
"Angular2",
"angular2-seed",
"official angular 2 seed",
"official angular2 seed"
],
"repository": {
"type": "git",
"url": "git+https://github.com/angular/angular2-seed.git"
},
"bugs": {
"url": "https://github.com/angular/angular2-seed/issues"
},
"homepage": "https://github.com/angular/angular2-seed#readme"
}好的,我刚刚意识到链接在包文件中,所以我想你们也可以看看。
发布于 2017-11-25 12:52:28
听起来你想升级。我建议你安装Angular CLI,用ng new MyNewAwesomeAngularProject创建一个新项目,然后移动你的代码,修复出现的问题。从长远来看,这将使你免于一些令人头疼的事情。
https://stackoverflow.com/questions/47482305
复制相似问题