On ionic angular, storybook display a message error :
ERROR in ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: C:\Users\foo\workspaces\tmp\photo-gallery\src\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at C:\Users\foo\workspaces\tmp\photo-gallery\node_modules\@ngtools\webpack\src\ivy\loader.js:75:26
For reproduct the error :
npm install -g @ionic/cli native-run cordova-res
ionic start photo-gallery tabs --type=angular --capacitor
npx storybook@latest init
I tried :
- with standalone and NgModules components
- on windows and mac
I think this is related to ionic/angular, because I tried with only angular, and it's working well.
On ionic angular, storybook display a message error :
ERROR in ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: C:\Users\foo\workspaces\tmp\photo-gallery\src\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at C:\Users\foo\workspaces\tmp\photo-gallery\node_modules\@ngtools\webpack\src\ivy\loader.js:75:26
For reproduct the error :
npm install -g @ionic/cli native-run cordova-res
ionic start photo-gallery tabs --type=angular --capacitor
npx storybook@latest init
I tried :
- with standalone and NgModules components
- on windows and mac
I think this is related to ionic/angular, because I tried with only angular, and it's working well.
Share Improve this question edited 21 hours ago Xero asked 22 hours ago XeroXero 4,1735 gold badges43 silver badges81 bronze badges 1- I have open an issue on github/storybookjs/storybook/issues/30577 – Xero Commented 20 hours ago
1 Answer
Reset to default -1This is a known issue with Angular/Ionic projects and Storybook's webpack configuration. To resolve:
- Add polyfills.ts to your tsconfig.json's 'files' array:
{ "files": ["src/polyfills.ts"] }
- If the error persists, modify your .storybook/main.ts to include the polyfills:
typescript export default { webpackFinal: async (config) => { config.entry.unshift('src/polyfills.ts'); return config; } };
From answer of https://github/storybookjs/storybook/issues/30577#issuecomment-2667984651