최대 1 분 소요

오류 메시지

TypeError: Cannot read property ‘NormalModule’ of undefined



개발 환경

  • m1 mac
  • Vue3
  • Webpack5
  • Storybook6



문제상황

npm run serve로 vue를 실행할 경우 잘 작동하였는데 npm run storybook를 실행 할 경우 아래와 같은 오류를 내뿜는다.

TS1



문제 원인은 webpack과 storybook은 둘 다 build 옵션이 포함된 도구이므로 생기는 것으로 추정된다.

공식 해결책은 npx sb init --builder webpack5 이나, 그 전에 깃허브를 refresh 시켜주어야 한다. (물론 깃허브에 연결되어있을 경우 일 것이다.)

git reset --hard , git clean -fd 이 두 명령어를 입력한 후, npx sb init --builder webpack5 하면 Storybook이 잘 작동 할 것이라 본다.

아래는 깃에서 얻을 수 있었던 답변 전문이다.

https://github.com/storybookjs/storybook/issues/17745#

npx sb init --builder webpack5 Also worked for me but only after a full project reset, so git reset --hard; git clean -fd, them deleting and reinstalling node_modules. Finally, npx sb init --builder webpack5 worked and get Storybook running in an existing Vue 3 project.




참고한 공식 문서: https://storybook.js.org/blog/storybook-for-webpack-5/

댓글남기기