instructions.md tsconfig.json
The following instructions are collated from storybookjs/storybook#14877
mkdir storybook-esm-react-webpack5cd storybook-esm-react-webpack5npm init -y
# manually add "type":"module" to package.jsonnpm i react react-domnpm i typescript webpack@5 --save-devnpx sb init --builder webpack5mv .storybook/main.js .storybook/main.cjsmkdir srcmv stories/ to src/
# add `{}` to `.storybook/package.json`
# add tsconfig.json
# update stories glob in .storybook/main.cjs
# update storybook/main.cjs to add workaround: https://github.com/badsyntax/storybook-webpack5-module/blob/master/.storybook/main.cjs#L20
# now for TS fully specified paths supportnpm i --save-dev resolve-typescript-plugin
# now manually add the plugin to your webpack config, see: https://github.com/benjambles/my-own-world/blob/57eb64831d302f36a2d66397a6d04738ab5453b4/packages/ui/.storybook/main.cjs#L33npm run storybook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "compilerOptions": { | |
| "target": "ES2020", | |
| "module": "ES2020", | |
| "rootDir": "./src", | |
| "outDir": "./lib", | |
| "strict": true, | |
| "noImplicitAny": true, | |
| "esModuleInterop": true, | |
| "moduleResolution": "node", | |
| "declaration": true, | |
| "jsx": "react-jsx", | |
| "sourceMap": true | |
| }, | |
| "exclude": ["node_modules", "lib"] | |
| } |