Build and watch with babel and typescript
- Transpiles js and jsx files for specific envs (node, webpack, modern browsers webpack 2)
- Transform yml files to json (for faster load)
- Allow you to register plugins to transform more files by extension
npm install --save-dev pob-babel
Also install babel plugins and presets
In package.json
{
"pob": {
"babelEnvs": [
{
"target": "node",
"version": "14",
"formats": ["es"]
},
{
"target": "browser",
"version": "modern",
"formats": ["es"]
},
{
"target": "browser",
"formats": ["es"]
}
],
"entries": ["index"]
}
}
Create rollup.config.mjs
import createRollupConfig from "pob-babel/createRollupConfig.js";
export default createRollupConfig({
cwd: new URL(".", import.meta.url).pathname,
});
rollup --config rollup.config.mjs
Edit your package.json:
{
"scripts": {
"build": "rollup --config rollup.config.mjs",
"watch": "yarn build --watch"
}
}