Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 951 Bytes

usage.md

File metadata and controls

26 lines (17 loc) · 951 Bytes

TypeScript Modules

Most Toba libraries are published to npm in their original TypeScript format. This has a few simple implications.

https://twitter.com/ausginer/status/1072183853207425025

Bundling

Nothing should need to change for bundlers (Webpack, Rollup, etc.) already configured to handle TypeScript. They will traverse the dependency graph and transform as usual.

Jest

Normally everything in node_modules is excluded from transformation which means TypeScript there will cause syntax errors.

To run Jest tests with ts-jest the jest.config.js file must include a transformIgnorePattern that causes ./node_modules/@toba modules to be transformed (the double negative can be a little confusing).

module.exports = {
   ...
   transformIgnorePatterns: [
      "<rootDir>/node_modules/(?!@toba)"
   ];
}