-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit to only using require to let Rollup bundler to detect the file as cjs file #857
Limit to only using require to let Rollup bundler to detect the file as cjs file #857
Conversation
87d873d
to
2aab9be
Compare
f4424e4
to
2aab9be
Compare
@@ -80,6 +80,7 @@ export class StoriesBrowser extends BaseBrowser { | |||
timeout: 60_000, | |||
}, | |||
); | |||
await this.page.waitForTimeout(500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to throw an Execution context was destroyed
error if we don't wait for some time here, so I added some timeouts. I'm not sure why this is happening though.
ref: https://github.com/reg-viz/storycap/actions/runs/8354226734/job/22867216673#step:7:99
when will this pr be merged? waiting for this 👍 |
This comment was marked as resolved.
This comment was marked as resolved.
@Quramy Without setting this resolve.alias, when you try to build the storybook, it will result in throwing the following error. => Failed to build the preview
Error: [commonjs--resolver] Failed to resolve entry for package "storycap". The package may have incorrect main/module/exports specified in its package.json. It seems that the I've added a pre hooks to build-storybook for populating the storycap build with 5c26134 to resolve the error you are getting, should this resolve the issue? |
examples/v8-vite5/package.json
Outdated
"build-storybook": "storybook build", | ||
"prestorybook": "../../scripts/e2e-prestorybook.js .", | ||
"prebuild-storybook": "../../scripts/e2e-prestorybook.js .", | ||
"storycap:all": "yarn prestorybook && yarn test && storycap --verbose --server-timeout 100000 --server-cmd \"storybook dev -p 9009\" \"http://localhost:9009\"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be tested with not dev mode but production build such as:
"storycap:all": "yarn build-storybook && yarn test && storycap --verbose --server-timeout 100000 --server-cmd \"http-server -p 9009 storybook-static\" \"http://127.0.0.1:9009\""
Note
The following script requires yarn add http-server -D
import { ScreenshotOptions } from '../shared/types'; | ||
import { triggerScreenshot } from './trigger-screenshot'; | ||
import type { ScreenshotOptions } from '../shared/types'; | ||
const { triggerScreenshot } = require('./trigger-screenshot'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it means that import statements are prohibited under storycap/src/client
? 🤔
Thank you!! |
May fix #856 ?
Having import statements in a file makes
@rollup/plugin-commonjs
to skip the conversion from CommonJS to ES Module.Changing the import statement to require should make
@rollup/plugin-commonjs
handle the file and successfully convert it.