Combining babel and tsup

123 views Asked by At

I wrote a custom babel plugin that is able to remove jsx attributes from a SVG file, just like this plugin does, just in nested tags. This is to run in a custom node package I need to use in my React Native app, so I need to build the package as well. I am thinking to use tsup for that purpose.

Tsup has deprecated the --babel flag and I'm not quite sure how I need to combine it with babel so the package will build and transpile the SVGs correctly.

I tried to add "build": "babel src -d build --extensions '.ts,.tsx,.svg' && tsup --clean" to my package.json, but running these one after the other has tsup remove the transpiled svg folder after babel generates it.

I believe I need to somehow integrate things into tsup via tsup.config.js but not sure how.

I'm not opposed to using a different tool to build the project, but it will be nice to have one that can run "dev" that will listen to file changes and recompile.

0

There are 0 answers