首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >d3v5角8生产方式-误差TypeError:(Void0)不是函数

d3v5角8生产方式-误差TypeError:(Void0)不是函数
EN

Stack Overflow用户
提问于 2019-11-17 07:59:22
回答 2查看 1.2K关注 0票数 4

D3v5函数在开发模式下工作良好,但在生产模式中抛出运行时错误。

ERROR TypeError:(Void0)不是函数

类型脚本代码

代码语言:javascript
复制
import { Component } from '@angular/core';
import {timeFormat} from 'd3-time-format';
...
export class AppComponent {

  constructor(){
    var formatTime = timeFormat("%B %d, %Y");
   console.log('Time parser :: ', formatTime(new Date))
  }
}

Package.json

代码语言:javascript
复制
  "dependencies": {
    "@angular/animations": "~8.1.1",
    "@angular/common": "~8.1.1",
    "@angular/compiler": "~8.1.1",
    "@angular/core": "~8.1.1",
    "@angular/forms": "~8.1.1",
    "@angular/platform-browser": "~8.1.1",
    "@angular/platform-browser-dynamic": "~8.1.1",
    "@angular/router": "~8.1.1",
    "@types/d3": "^5.7.2",
    "d3": "^5.13.1",
    "rxjs": "~6.4.0",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },

tsconfig.json -也尝试按照Error in d3.js after upgrading to Angular 8更新目标

代码语言:javascript
复制
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    **"target": "es5",**
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": ..
  },
  "angularCompilerOptions": ..
}

如有任何建议或线索,将不胜感激。

谢谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-11-20 07:16:28

对于任何遇到类似问题的人,我都可以通过将d3和角转到下面的版本来使它工作。

代码语言:javascript
复制
 "dependencies": {
    "@angular/animations": "~8.2.14",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "@types/d3": "^5.7.2",
    "d3": "^5.14.0",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
票数 3
EN

Stack Overflow用户

发布于 2019-12-11 06:55:52

更新@角-devkit/build版本之后,

“@angular/build-角”:"~0.801.2“

“@angular/build”:"^0.803.17“

为我工作。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58898594

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档