I have the following file structure:
application1
|pacakge.json
|src
||file1.ts
widget-lib
|package.json
|src
||file2.ts
||index.ts
.\widget-lib\src\index.ts
bundles and reexports everything in widget-lib
package.
export * from '.\file2'
.\application1\src\file1.ts
and other files refence widget-lib
by alias
import { foo } from 'widget-lib';
I'm compiling .\application1\src\
with Babel into .\application1\build-test\
, how do I instruct Babel to also include widget-lib
into this particular compilation? My goal is to produce a folder with all JS files needed to debug unit tests in modern node with esm
package - just strip down TS types and put resulting JS files into proper place, like this:
application1
|build-test
||application1
|||src
||||file1.js
||widget-lib
|||src
||||index.js
||||file2.js
I'm using https://github.com/tleunen/babel-plugin-module-resolver
to rewrite alias paths like 'widget-lib' to expected relative paths, I just need to instruct babel to also include the actual files from widget-lib
into .\build-test\widget-lib
folder. I tried passing both .\application1\src
and .\widget-lib\src
together to Babel, but than it outputs content of both .\src
folders into one.
I ended up running several babel process in parallel, spawning them with a node script as described here Execute a command line binary with Node.js and using the script to analyze their output and emit additional information.