- ReasonML Quick Start Guide
- Raphael Rafatpanah Bruno Joseph D'mello
- 153字
- 2021-07-02 12:34:16
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 commonjs, and other available options include amdjs, amdjs-global, es6, 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
},