Broccoli TypeScript Compiler (broccoli-typescript-compiler) is a specialized Broccoli plugin designed to integrate TypeScript compilation directly into a Broccoli.js build pipeline. Currently stable at version 8.0.0, this package provides robust tooling for converting TypeScript files into JavaScript, supporting both CommonJS and ES modules targets. It allows for flexible configuration via `tsconfig.json` files or inline objects, enabling developers to define compiler options such as module resolution, target ES version, source maps, and declaration file generation. Key differentiators include its tight integration with the Broccoli ecosystem, offering three distinct usage patterns: a direct compilation function, a class-based compiler for more control, and a filter function that intelligently processes only TypeScript files while passing non-TypeScript assets through. While a specific release cadence isn't published, the project actively maintains compatibility with recent TypeScript versions, ensuring it remains a viable solution for Broccoli-based projects requiring TypeScript support.
npm install broccoli-typescript-compilerVerified import paths — ran on the pinned version, not inferred.
Demonstrates compiling TypeScript files within a Broccoli build, using a custom tsconfig and handling production error settings.
Be aware of the `NODE_ENV` impact. To always allow non-breaking errors regardless of `NODE_ENV`, you may need to explicitly set `throwOnError: false` and ensure `process.env.NODE_ENV` is not 'production' if you intend for errors to be non-fatal.
Always follow the 'How to upgrade `typescript`' instructions in the project's README when updating the `typescript` peer dependency. This typically involves `git submodule update --init`, updating `package.json`, running `yarn run generate-tsconfig-interface`, and updating the `vendor/typescript` submodule.
Ensure you are integrating this package within a Broccoli.js `Brocfile.js` or a similar Broccoli-managed build process. For standalone TypeScript compilation, use the `typescript` package directly.
Install the required `typescript` version: `npm install typescript@^4.0.3` (or the version specified in peerDependencies) in your project.
Review the `[ERROR_MESSAGE]` output for specific TypeScript errors. Fix the TypeScript code issues, or set `throwOnError: false` (being mindful of the `NODE_ENV` default override) if you want to allow the build to proceed with errors.
Ensure `tsconfig` is either an absolute path string to a `tsconfig.json` file or a valid JavaScript object matching the structure of `tsconfig.json`'s `compilerOptions` and other root-level properties.