ReasonML Quick Start Guide
上QQ阅读APP看书,第一时间看更新

The package-specs field

The package-specs field contains two fields: module and in-source.

The module field controls the JavaScript module format. The default is commonjsand other available options include amdjs, amdjs-globales6, and es6-global. The -global part tells BuckleScript to resolve node_modules to relative paths for browsers.

The in-source field controls the destination of the generated JavaScript files; true results in the generated files being placed along side source files, and false results in the generated files being placed in lib/js. Setting in-source to false is useful when using Reason within an existing JavaScript project so that the existing build pipeline can be used without having to change.

Let's use the "es6" module format for now, and place our compiled assets in lib/js:

"package-specs": {
"module": "es6",
"in-source": false
},