将 Reason 源文件编译到与源文件相同的目录
Compiling Reason source files to the same directory as the source files
我正在编写一个节点应用程序,我想在其中混合 Reason 和原始 JavaScript。
This section 在 bucklescript 文档中对其进行了描述
When user has an existing JS project, it makes sense to output the JS
file in the same directory as vanilla JS, the schema added a key
called in-source
so that generate JS file next to ML file.
我假设这是在 bsconfig.json
文件中?但是密钥应该有什么值呢? The schema documentation没有提到这个选项。
我是 运行 Bucklescript 版本 1.9.1 - 所以该功能应该可用(从 1.9.0 开始可用)。
如何使用 in-source
选项?
我的 bsconfig.json
文件如下所示:
{
"name": "re-server",
"version": "0.1.0",
"bsc-flags": ["-bs-super-errors"],
"in-source": true, // I tried adding the key here
"sources": [{
"dir": "src",
"in-source": true // I tried adding the key here
}
],
"bs-dependencies" : [
"bs-express"
]
}
它应该在 "package-specs" 部分:
{
...
"package-specs" : [{
"module": ...,
"in-source": true
}]
}
所以你的 bsconfig.json
应该是这样的:
{
"name": "re-server",
"version": "0.1.0",
"bsc-flags": ["-bs-super-errors"],
"package-specs" : [{
"module": "commonjs",
"in-source": true
}],
"sources": [{
"dir": "src"
}
],
"bs-dependencies" : [
"bs-express"
]
}
我正在编写一个节点应用程序,我想在其中混合 Reason 和原始 JavaScript。
This section 在 bucklescript 文档中对其进行了描述
When user has an existing JS project, it makes sense to output the JS file in the same directory as vanilla JS, the schema added a key called
in-source
so that generate JS file next to ML file.
我假设这是在 bsconfig.json
文件中?但是密钥应该有什么值呢? The schema documentation没有提到这个选项。
我是 运行 Bucklescript 版本 1.9.1 - 所以该功能应该可用(从 1.9.0 开始可用)。
如何使用 in-source
选项?
我的 bsconfig.json
文件如下所示:
{
"name": "re-server",
"version": "0.1.0",
"bsc-flags": ["-bs-super-errors"],
"in-source": true, // I tried adding the key here
"sources": [{
"dir": "src",
"in-source": true // I tried adding the key here
}
],
"bs-dependencies" : [
"bs-express"
]
}
它应该在 "package-specs" 部分:
{
...
"package-specs" : [{
"module": ...,
"in-source": true
}]
}
所以你的 bsconfig.json
应该是这样的:
{
"name": "re-server",
"version": "0.1.0",
"bsc-flags": ["-bs-super-errors"],
"package-specs" : [{
"module": "commonjs",
"in-source": true
}],
"sources": [{
"dir": "src"
}
],
"bs-dependencies" : [
"bs-express"
]
}