sourceMappingURL返回完整路径。如何关闭它?

时间:2017-01-26 01:58:40

标签: angular typescript source-maps tsc angular2-aot

我有自己的Angular 2库,并尝试使用Angular2官方ngc编译器进行编译。一切正常,但当我检查生成的代码时,我发现sourceMappingURL返回完整路径。当我要发货时,我不应该想要sourceMappingURL中的完整路径。

我运行的命令是npm run ngc

以下是我的配置文件:

tsconfig.json

{
    "compilerOptions": {
        "baseUrl": "./",
        "target": "es5",
        "module": "es2015",
        "moduleResolution": "node",
        "declaration": true,
        "noImplicitAny": false,
        "sourceMap": true,
        "mapRoot": "",
        "emitDecoratorMetadata": true,  
        "experimentalDecorators": true,
        "outDir": "./dist",
        "rootDir": "./",
        "skipLibCheck": true,
        "typeRoots": [
            "./node_modules/@types",
            "./typings"
        ],
        "types": [
            "node",
            "jquery"
        ],
        "lib": [
            "dom",
            "es2015"
        ]
    },
    "compileOnSave": false,
    "buildOnSave": false,
    "files": [
        "./typings/ng2-sdk.d.ts",
        "./reusable/CommonModule"
    ],
    "exclude": [
        "node_modules",
        "dist",
        "**/*.ngfactory.ts",
        "**/*.shim.ts"
    ],
    "angularCompilerOptions": {
        "genDir": "./dist",
        "skipMetadataEmit" : false,
        "entryModule": "./reusable/CommonModule#CommonModule"
    }
}

的package.json

{
  "name": "ng2-sdk",
  "version": "0.0.1",
  "scripts": {
    "cleanup": "rimraf ./**/*.ngfactory.ts ./**/*.ngstyle.ts ./**/*.ngsummary.json build dist",
    "ngc": "ngc -p tsconfig.json",
    "start": "npm run cleanup && npm run ngc",
    "start-prod": "npm run ngc && npm run build",
    "build": "npm run cleanup && npm run ngc && webpack --config webpack.config.js -p",
    "deploy": "gh-pages -d dist",
    "aot": "npm run cleanup && npm run ngc",
    "jit": "npm run cleanup"
  },
  "dependencies": {
    "@angular/common": "^2.4.4",
    "@angular/compiler": "^2.4.4",
    "@angular/compiler-cli": "^2.4.4",
    "@angular/core": "^2.4.4",
    "@angular/forms": "^2.4.4",
    "@angular/http": "^2.4.4",
    "@angular/platform-browser": "^2.4.4",
    "@angular/platform-browser-dynamic": "^2.4.4",
    "@angular/router": "^3.4.4",
    "angular2-jwt": "0.1.25",
    "angulartics2": "1.5.1",
    "bootstrap": "3",
    "bootstrap-sass": "3.3.6",
    "core-js": "2.4.1",
    "dateformat": "^1.0.12",
    "flickity": "2.0.4",
    "flickity-bg-lazyload": "1.0.0",
    "intl": "1.1.0",
    "jquery": "2.2.3",
    "json-editor": "git+https://github.com/jdorn/json-editor.git",
    "lodash": "4.11.1",
    "moment": "^2.17.1",
    "ng2-datetime-picker": "^0.12.0",
    "ng2-file-upload": "1.1.4-2",
    "perfect-scrollbar": "git+https://github.com/noraesae/perfect-scrollbar.git",
    "process": "^0.11.9",
    "reflect-metadata": "0.1.8",
    "rx-dom": "7.0.3",
    "rxjs": "^5.0.3",
    "selectize": "git+https://github.com/brianreavis/selectize.js.git",
    "typescript": "2.1.5",
    "urijs": "1.17.1",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^2.4.4",
    "@angular/platform-server": "^2.4.4",
    "@types/jquery": "^2.0.39",
    "@types/node": "7.0.0",
    "angular2-template-loader": "0.6.0",
    "awesome-typescript-loader": "3.0.0-beta.18",
    "chokidar": "1.6.1",
    "concurrently": "3.1.0",
    "gh-pages": "0.12.0",
    "raw-loader": "0.5.1",
    "rimraf": "2.5.4",
    "source-map-explorer": "1.3.3",
    "style-loader": "0.13.1",
    "to-string-loader": "1.1.5",
    "typescript": "2.0.10",
    "webpack": "2.2.0"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/??????/??????.git"
  }
}

1 个答案:

答案 0 :(得分:0)

...喔

在tsconfig.json

"mapRoot": "",< - 删除