mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
packages/browser never extended the workspace base and had drifted to target ES5 with node16 resolution. Both are things its source contradicts. ES5 has no iteration protocol, so every `for (const x of aSet)` and spread over an iterable failed: error TS2802: Type 'Set<string>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher downlevelIteration keeps the ES5 output and lets the code say what it says. node16 judged every file CommonJS, so the ESM-only imports were errors: error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module. This is bundled by rollup, not resolved by node, so it uses esnext/bundler — the pair the workspace base already uses. With browser building, the react package compiled for the first time and stopped on one unguarded access: featureFlags is TreeShakeable, so a consumer that opts into tree shaking gets undefined. The same file already guards it two lines later; the initial useState did not. Verified: 33 of 33 build tasks pass, zero TS errors.
37 lines
1.3 KiB
JSON
37 lines
1.3 KiB
JSON
{
|
|
"compilerOptions": {
|
|
"outDir": "./lib",
|
|
"target": "ES5",
|
|
// ES5 has no iteration protocol, so `for (const x of aSet)` and spread
|
|
// over an iterable do not compile without this. The code uses both.
|
|
"downlevelIteration": true,
|
|
"lib": ["dom", "dom.iterable", "esnext"],
|
|
"allowJs": true,
|
|
"checkJs": true,
|
|
"skipLibCheck": true,
|
|
"esModuleInterop": true,
|
|
"allowSyntheticDefaultImports": true,
|
|
"strict": true,
|
|
"forceConsistentCasingInFileNames": true,
|
|
// This is bundled by rollup, not resolved by node. node16 judged every
|
|
// file CommonJS and refused each ESM-only import:
|
|
// error TS1479: The current file is a CommonJS module whose imports
|
|
// will produce 'require' calls; however, the referenced file is an
|
|
// ECMAScript module.
|
|
// Same pair the workspace base uses.
|
|
"module": "esnext",
|
|
"moduleResolution": "bundler",
|
|
"isolatedModules": true,
|
|
"noImplicitReturns": true,
|
|
"noUnusedParameters": true,
|
|
"sourceMap": true,
|
|
"inlineSources": true,
|
|
"resolveJsonModule": true,
|
|
"declaration": true,
|
|
"jsx": "react-jsx",
|
|
"jsxImportSource": "preact"
|
|
},
|
|
"include": ["./src/**/*.ts*"],
|
|
"exclude": ["./src/__tests__/**/*.ts*"]
|
|
}
|