ppo*_*ani 8 ecmascript-6 karma-runner webpack
每次导入模块时都会执行ES6模块中的代码吗?我正在使用webpack,它似乎确实如此.
// FormStore.js
import sessionActions from "../../session/actions/session";
// session.spec.js
import sessionActions from "../../../src/session/actions/session";
This causes the code in the session module to be executed twice
Run Code Online (Sandbox Code Playgroud)
我不知道确切的答案,但我怀疑这与业力有关。我认为这是因为有两个不同的捆绑包。
在karma.config
preprocessors: {
"client/specs/index.ts": ["webpack"],
"client/specs/**/*spec.ts": ["webpack"]
},
webpack: {
entry: {
index: "./client/src/index.tsx",
vendor: []
}
},
Run Code Online (Sandbox Code Playgroud)
基本上,我真的不需要添加index入口点,因为这可能会创建一个额外的包。
| 归档时间: |
|
| 查看次数: |
824 次 |
| 最近记录: |