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
Copy file name to clipboardExpand all lines: src/pages/guides/ecosystem/storybook.md
+2-141Lines changed: 2 additions & 141 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,8 @@ We were not able to detect the right builder for your project. Please select one
47
47
Webpack 5
48
48
```
49
49
50
+
> See our Vitest docs to see additional configuration examples for [Import Attributes](/guides/ecosystem/vitest/#import-attributes) and [Greenwood resource plugins](/guides/ecosystem/vitest/#resource-plugins); updating your _vite.config.js_ file instead.
51
+
50
52
## Usage
51
53
52
54
You should now be good to start writing your first story! 📚
@@ -145,147 +147,6 @@ You'll want to create a CommonJS version with the following name, depending on w
145
147
146
148
<!-- prettier-ignore-end -->
147
149
148
-
## Import Attributes
149
-
150
-
As [Vite does not support Import Attributes](https://github.com/vitejs/vite/issues/14674), we will need to create a _vite.config.js_ and write a [custom plugin](https://vitejs.dev/guide/api-plugin) to work around this.
151
-
152
-
In this example we are handling for CSS Module scripts:
If you're using one of Greenwood's [resource plugins](/docs/plugins/), you'll need a _vite.config.js_ so we can create a custom transformation plugin that can leverage Greenwood's plugins to automatically handle custom transformations.
226
-
227
-
For example, if you're using Greenwood's [Raw Plugin](https://github.com/ProjectEvergreen/greenwood/tree/master/packages/plugin-import-raw), you'll need to create a wrapping Vite plugin to handle this transformation.
const response = await rawResource.intercept(new URL(`file://${filename}`), null, new Response(contents));
271
-
const body = await response.text();
272
-
273
-
return body;
274
-
}
275
-
},
276
-
};
277
-
}
278
-
279
-
export default defineConfig({
280
-
// 5) add it the plugins option
281
-
plugins: [transformRawImports()],
282
-
});
283
-
```
284
-
285
-
</app-ctc-block>
286
-
287
-
<!-- prettier-ignore-end -->
288
-
289
150
## Content as Data
290
151
291
152
If you are using any of Greenwood's Content as Data [Client APIs](/docs/content-as-data/data-client/), you'll want to configure Storybook to mock the HTTP calls Greenwood's data client makes, and provide the desired response needed based on the API being called.
0 commit comments