- Webpack environment for authoring recipes.
Install
npm i -D @openrewrite/webpack-environment
Setup Checklist
- Use the provided webpack configuration directly or merge it into your custom configuration:
const openRewriteWebpackConfig = require('@openrewrite/webpack-environment');
const webpackConfig = () => openRewriteWebpackConfig({ sourceDir: 'ts', outputDir: 'js' });
module.exports = webpackConfig;
- Make sure you tsconfig.json is extending the provided tsconfig:
{
"extends": "@openrewrite/webpack-environment/tsconfig.recipe.json",
"include": [
"ts/*.ts",
"test/*.ts",
"node_modules/@openrewrite/types/**/*.ts",
"node_modules/@openrewrite/**/jest.d.ts"
]
}
- Run webpack
How To Use
Running webpack will compile your typescript recipes into a specific target javascript compatible with the OpenRewrite polyglot layer.
Additionally, some extra files will be generated:
index.ts
This file is used to generate a final index.js
file which contains your recipes.
The index.js
is what your package.json's main
property should point to.
categories.ts
This is generated from a .openrewriterc
file. We use
Cosmic Config so you can supply
the categories config multiple ways. A category should be defined for your
recipes to identify with.