kem*_*ica 7 javascript typescript
为什么我收到以下错误?我忘记在我的HTML中添加脚本了吗?
ReferenceError:找不到变量:exports
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* more code */
Run Code Online (Sandbox Code Playgroud)
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"noImplicitAny": true,
"rootDir": ".",
"sourceRoot": "../../../",
"outDir": "../../../js/dist/",
"sourceMap": false
},
"exclude": [
"node_modules"
]
}
Run Code Online (Sandbox Code Playgroud)
requirejs包含在html中的js文件之前
有类似的问题,但这只是关于打字稿而不是关于余烬/巴贝尔等.
我无法重现。您的保释tsconfig.json理由tsc
错误 TS5051:仅当提供选项“--inlineSourceMap”或选项“--sourceMap”时才能使用选项“sourceRoot”。
一旦我删除该选项,输出中sourceRoot就没有任何引用。exports
$ls
my.ts tsconfig.json
Run Code Online (Sandbox Code Playgroud)
$ 猫 my.ts
console.log(1)
Run Code Online (Sandbox Code Playgroud)
$ 猫 tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"noImplicitAny": true,
"rootDir": ".",
"sourceRoot": "../../../",
"outDir": "../../../js/dist/",
"sourceMap": false
},
"exclude": [
"node_modules"
]
}
Run Code Online (Sandbox Code Playgroud)
$ tsc --版本
Version 3.5.3
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2076 次 |
| 最近记录: |