In https://github.com/microsoft/TypeScript/pull/51387 the codebase changed to use ESBuild. And now `require('typescript')` will include `__esModule: true` and that is a breaking change. ``` > require("typescript").version '4.9.2-rc' > require("typescript").__esModule undefined > ``` ``` > require('typescript').version '5.0.0-dev.20221109' > require('typescript').__esModule true > ``` This crashes https://github.com/hipstersmoothie/react-docgen-typescript-plugin ``` TypeError: Cannot read properties of undefined (reading 'JsxEmit') at DocgenPlugin.getOptions (node_modules/@storybook/react-docgen-typescript-plugin/dist/plugin.js:246:39) ``` It's output code uses `tslib.importDefault` to import typescript. ```ts const typescript_1 = tslib_1.__importDefault(require("typescript")); let compilerOptions = { jsx: typescript_1.default.JsxEmit.React, // ~~~~~~~~~~~~~~~~~~~~ ts namespace before, undefined after module: typescript_1.default.ModuleKind.CommonJS, target: typescript_1.default.ScriptTarget.Latest, }; ```
Activity
jakebailey commentedon Nov 10, 2022
Thanks for testing this so early. This is unfortunate.
Can you try with
"typescript": "npm:@typescript-deploys/pr-build@5.0.0-pr-51474-2"and see if the issue goes away? (from #51474)Jack-Works commentedon Nov 10, 2022
yes, this fixes the problem