风格2中不起作用的样式表的相对路径

时间:2017-11-25 03:20:23

标签: angular typescript systemjs

我在使用样式表工作时遇到了一些麻烦。我仍在使用Angular2,我下载的种子比我之前使用的种子更新,因此在此时使用moduleId : module.id已被弃用。如果没有moduleId相对路径不起作用,我现在必须从app文件夹开始执行完整路径。这只是我必须做的事情还是有解决方法呢?

我发现了一些文章,其中一篇建议我们使用moduleId: module.id + ""来解决问题,因为webpack使用数字而Angular需要一个字符串。在尝试使用相对路径时,我仍然收到错误,告诉我css文件无法加载。

我尝试更新成功但未改变行为的webpackangular-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"
}

好的,我只是意识到链接在包文件中,所以我想你们也可以看一下。

1 个答案:

答案 0 :(得分:0)

听起来你想要升级。我建议您安装Angular CLI,使用pkill创建一个新项目并移动代码,修复出现的内容。从长远来看,这将使您免于一些大麻烦。

https://cli.angular.io/

相关问题