Dev and build your code painlessly in monorepos
Dev and build your code painlessly in monorepos
Dev and build your code painlessly in monorepos
Assuming you already have a source file at src/index.js (or src/index.ts) or you're using pnpm workspaces and have packages with src/index.js (or src/index.ts), you can setup Preconstruct like this.
pnpm add --save-dev @preconstruct/cli
pnpm preconstruct initIf you're in a monorepo, you should also run pnpm preconstruct dev and add it to a postinstall script("postinstall": "preconstruct dev") that runs preconstruct dev so that you can import your code without having to rebuild your project every time in changes.
Before you publish packages to npm, run preconstruct build. Preconstruct will use your Babel config and build flat bundles so make sure to configure Babel with the transforms you want.
We strongly recomment making a single script in your package.json that runs both build and publish, to stop broken publishes, such as
"release": "preconstruct build && pnpm publish:packages. If you're in a single-package repo, you could also runpreconstruct buildin aprepareorprepublishOnlyscript.
There are a number of tasks that become easier with preconstruct that lie slightly outside the main workflow. Check out the following guides for setting these up.
No open issues yet, or sync has not completed.