npm install tool-libraries
// or
yarn add tool-libraries
import {types} from 'tool-libraries'
const now = new Date()
types.typeof(now) // date
types.isDate(now) // true
See the tool-libraries documentation for more details.
yarn add babel-plugin-library -D
// or
npm install babel-plugin-library -D
.babelrc
{
"plugins": [
[
"babel-plugin-library",
{"libraryName": "tool-libraries"}
]
]
}
webpack
module: {
rules: [{
test: /\.js$/,
loader: "babel-loader",
}]
}
See the babel-plugin-library for more details.
In order to be compatible with the on-demand feature, each file must have a default export, and each function may be split into a single file, which helps to facilitate splitting when it is introduced.
MIT