unplugin-typesugar provides essential bundler integrations for `typesugar`, a TypeScript macro expansion library. It enables compile-time macro processing across various build tools, including Vite, Webpack, esbuild, and Rollup. Leveraging the `unplugin` ecosystem, it ensures broad compatibility and simplifies integration into existing JavaScript and TypeScript projects. The current stable version is 0.1.1, marked as an initial release candidate and first stable patch, indicating active, early-stage development with frequent updates addressing stability and feature enhancements. A key differentiator is its ability to expand TypeScript macros before the code enters the bundler's optimization pipeline, ensuring that macro-transformed code is fully optimized. It requires TypeScript 5.0 or newer as a peer dependency, aligning with modern TypeScript tooling practices.
npm install unplugin-typesugarVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to integrate unplugin-typesugar into a Vite project with common configuration options, including verbose logging, file pattern matching, disk caching, and strict type-checking of expanded output.
Review release notes carefully for any breaking changes when upgrading. Consider pinning to exact patch versions for critical applications.
Ensure your project's `typescript` peer dependency is satisfied by upgrading to `typescript@>=5.0.0` in your `package.json`.
Upgrade `unplugin-typesugar` to version 0.1.1 or newer to resolve this critical build issue.
Verify that `unplugin-typesugar` is installed (`npm install unplugin-typesugar` or `pnpm add unplugin-typesugar`) and that the import path matches your bundler (e.g., `import typesugar from 'unplugin-typesugar/vite';`).
For Webpack, use `const typesugar = require('unplugin-typesugar/webpack').default;` to correctly import the plugin.Upgrade your project's `typescript` dependency to `typescript@>=5.0.0` to ensure compatibility with the plugin's internal TypeScript program creation.