最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Storybook not working ionic angular ERROR in .srcpolyfills.ts - Stack Overflow

programmeradmin5浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default -1

This is a known issue with Angular/Ionic projects and Storybook's webpack configuration. To resolve:

  1. Add polyfills.ts to your tsconfig.json's 'files' array:

{ "files": ["src/polyfills.ts"] }

  1. 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

发布评论

评论列表(0)

  1. 暂无评论