core-js modules not found when using load all stories glob
See original GitHub issueDescribe the bug Multiple Can’t resolve ‘core-js/modules/’ errors, but only when using the .storybook/config.js to load all stories matching a glob method.
To Reproduce Steps to reproduce the behavior:
- Fresh install of Angular 8
- Fresh install of @storybook/angular following the guide at https://storybook.js.org/docs/guides/guide-angular/
- Create config.js file (see below)
- npm run storybook
- Errors.
Expected behavior Storybook to load just like it does if I specify individual file import without trying to match /.stories.ts$/
Screenshots
Code snippets .storybook/config.js: `import { configure } from ‘@storybook/angular’; import requireContext from ‘require-context.macro’;
const req = requireContext(‘…/src/app/modules’, true, /.stories.ts$/);
function loadStories() { req.keys().forEach(filename => req(filename)); }
configure(loadStories, module);`
package.json:
{ "name": "one-equality", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "storybook": "start-storybook" }, "private": true, "dependencies": { "@angular/animations": "^8.0.0", "@angular/cdk": "^8.0.0", "@angular/common": "~8.0.0", "@angular/compiler": "~8.0.0", "@angular/core": "~8.0.0", "@angular/flex-layout": "^8.0.0-beta.26", "@angular/forms": "~8.0.0", "@angular/material": "^8.0.0", "@angular/platform-browser": "~8.0.0", "@angular/platform-browser-dynamic": "~8.0.0", "@angular/router": "~8.0.0", "core-js": "^2.5.4", "hammerjs": "^2.0.8", "require-context.macro": "^1.0.4", "rxjs": "~6.5.2", "tslib": "^1.9.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.800.0", "@angular/cli": "~8.0.0", "@angular/compiler-cli": "~8.0.0", "@angular/language-service": "~8.0.0", "@babel/core": "^7.4.5", "@storybook/angular": "^5.1.3", "@types/jasmine": "~2.8.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "babel-loader": "^8.0.6", "codelyzer": "~4.5.0", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.11.0", "typescript": "~3.4.5" } }
System:
- OS: Ubuntu via WSL on Windows 10
- Device: Dell Inspiron
- Browser: Chrome/Firefox latest for both
- Framework: Angular
- Addons: None
- Version: Storybook - ^5.1.3 Angular - ~8.0.0 core-js - ^2.5.4
Additional context I have tried upgrading core-js to 3, to various specific versions of 2… nothing seems to work. As long as I use the load all stories method, I get those errors.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top GitHub Comments
This is fixed for me with storybook 5.1.5
Angular 8 dropped core-js as a dependency. You said
I did a fresh setup myself and it has worked - have you tried to follow the manual steps or have you used the CLI?
Can you try a fresh installation with
npx @angular/cli new angular8-project
cd angular8-project
npx @storybook/cli init
npm run storybook
Or try https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular-7 but this was originally a fix for Angular 7 with core-js 3