You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you change the main.ts file to main.js, remove the type imports and use module.exports syntax, the test runner runs without a problem.
I've also solved this by adding in a custom .babelrc file in my NextJs project, however this is not ideal as it overrides the new NextJs swc compiler which is necessary for many of NextJs's newest features.
For context, here is a previous issue for a non NextJs project: #17589
elliotgonzalez123
changed the title
[Bug]: Test runner does not run if main storybook config file a Typescript file in NextJs
[Bug]: Test runner does not run if main storybook config file is a Typescript file in NextJs
Feb 28, 2023
Describe the bug
In NextJs, after installing and setting up the storybook test runner, running
npm run test-storybook
throws the following error in the console.../Users/{{user}}/Desktop/my-app/.storybook/main.ts: Unexpected token, expected "from"
If you change the
main.ts
file tomain.js
, remove the type imports and usemodule.exports
syntax, the test runner runs without a problem.I've also solved this by adding in a custom
.babelrc
file in my NextJs project, however this is not ideal as it overrides the new NextJs swc compiler which is necessary for many of NextJs's newest features.For context, here is a previous issue for a non NextJs project: #17589
To Reproduce
A stackblitz repro can be found here: https://stackblitz.com/edit/github-uriqhe?file=package.json
npm run test-storybook
System
Additional context
No response
The text was updated successfully, but these errors were encountered: