Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 未定义网页包导出模块_Typescript_Webpack_Dependencies_Bundle - Fatal编程技术网

Typescript 未定义网页包导出模块

Typescript 未定义网页包导出模块,typescript,webpack,dependencies,bundle,Typescript,Webpack,Dependencies,Bundle,我想使用webpack为我的应用程序编译bundle.js。 通过将导入和导出添加到*.ts文件中,我创建了依赖关系树。 我在尝试运行应用程序时遇到一个问题 我有一个main.ts文件: import { componentA, componentB } from 'moduleX'; import { componentC } from 'moduleC' export var componentE: componentA; $().ready(function () { if

我想使用webpack为我的应用程序编译bundle.js。 通过将导入和导出添加到*.ts文件中,我创建了依赖关系树。 我在尝试运行应用程序时遇到一个问题

我有一个main.ts文件:

import { componentA, componentB } from 'moduleX';
import { componentC } from 'moduleC'

export var componentE: componentA;

$().ready(function () {

    if (componentA.someProperty === true) {

        ...
    }
}

export class MyClass extends componentC {
    ...
}

// end file
这是我的moduleX文件:

import { componentE } from 'main';
import { componentC } from 'moduleC'

export componentA extends componentC {

    ...

    if (componentE.someProperty === true) {

    }

    ...
}
在运行build dev并尝试运行我的应用程序后,我得到了如下结果:

Uncaught ReferenceError: componentC is not defined
    at eval (moduleX.js?d3a3:5913)
    at Object../js/moduleX.js (bundle.js?8.0.0:96)
    at __webpack_require__ (bundle.js?8.0.0:20)
    at eval (main.ts?8a84:4)
    at Object../js/main.ts (bundle.js?8.0.0:163)
    at __webpack_require__ (bundle.js?8.0.0:20)
    at bundle.js?8.0.0:84
    at bundle.js?8.0.0:87
当我在chrome的
moduleX.js?d3a3:5913查看源代码时,我可以看到:

var componentA = /** @class */ (function (_super) {
    __extends(componentA, _super);

    //componentA code

}(componentC));
我在
}(componentC)中有一个错误
未捕获引用错误:未定义组件C

问题在哪里? 你能帮我吗

问题在哪里?你能帮我吗

你有一个循环依赖

修理 移除它

例子 例如,
foo
依赖于
bar
依赖于
baz
依赖于
foo
(循环!)

工具 各种各样的。我也写了一篇: