Files
webstudio/patches/@storybook__builder-webpack5@6.5.14.patch
T
Bogdan Chadkin b3c87af7c1 Migrate to pnpm for package management (#641)
- setup corepack for pnpm and forbid yarn usage with "engines" field
- converted yarn lockfile into pnpm lockfile with `pnpm import` command
- replaced yarn with pnpm in scripts and github actions, had to use
custom cache to support corepack

This PR is only migration. Will use new pnpm features in other PRs.

```diff
du -ckd1 node_modules (yarn)
- 1125032

du -ckd1 node_modules/.pnpm
+ 857456
```

Install time (including cache downloads) in github actions reduced from
42s to 23s


## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
- [ ] what kind of review is needed?
  - [x] conceptual
  - [X] detailed
  - [ ] with testing

## Test cases

- [ ] step by step interaction description and what is expected to
happen

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2022-12-22 12:16:13 +03:00

26 lines
1.3 KiB
Diff

diff --git a/templates/virtualModuleModernEntry.js.handlebars b/templates/virtualModuleModernEntry.js.handlebars
index 30df5e4c42489b58e5dbca0402bf1f5d35f27a61..13bc5ae24a8db553999a72dca3104b16086a732d 100644
--- a/templates/virtualModuleModernEntry.js.handlebars
+++ b/templates/virtualModuleModernEntry.js.handlebars
@@ -11,8 +11,9 @@ import { importFn } from './{{storiesFilename}}';
const { SERVER_CHANNEL_URL } = global;
-const getProjectAnnotations = () =>
- composeConfigs([{{#each configs}}require('{{this}}'),{{/each}}]);
+// patch from https://github.com/storybookjs/storybook/pull/17108/commits/cde08674427f005aafc63a4cec7a216217974f53
+const getProjectAnnotations = async () =>
+ composeConfigs(await Promise.all([{{#each configs}}import('{{this}}'),{{/each}}]));
const channel = createPostMessageChannel({ page: 'preview' });
addons.setChannel(channel);
@@ -32,7 +33,8 @@ window.__STORYBOOK_CLIENT_API__ = new ClientApi({ storyStore: preview.storyStore
preview.initialize({ importFn, getProjectAnnotations });
-if (module.hot) {
+// patch from https://github.com/storybookjs/storybook/pull/19686/commits/2f676a2528a2baf1fdf9063642b9621a2fe3d566
+if (import.meta.webpackHot) {
import.meta.webpackHot.accept('./{{storiesFilename}}', () => {
// importFn has changed so we need to patch the new one in
preview.onStoriesChanged({ importFn });