@storybook/web-components-webpack5 8.0.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +2 -70
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,71 +1,3 @@
1
- # Storybook for web-components
1
+ # Storybook for Web components & Webpack
2
2
 
3
- ---
4
-
5
- Storybook for web-components is a UI development environment for your plain web-component snippets.
6
- With it, you can visualize different states of your UI components and develop them interactively.
7
-
8
- ![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/main/media/storybook-intro.gif)
9
-
10
- Storybook runs outside of your app.
11
- So you can develop UI components in isolation without worrying about app specific dependencies and requirements.
12
-
13
- ## Getting Started
14
-
15
- ```sh
16
- cd my-app
17
- npx storybook@latest init -t web_components
18
- ```
19
-
20
- For more information visit: [storybook.js.org](https://storybook.js.org)
21
-
22
- ---
23
-
24
- Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish.
25
- You can also build a [static version](https://storybook.js.org/docs/web-components/sharing/publish-storybook) of your storybook and deploy it anywhere you want.
26
-
27
- # Hot Module Reloading (HMR)
28
-
29
- As web components register on a global registry which only accepts a certain name/class once it can lead to errors when using classical HMR. There are ideas on how to archive HMR with a static registry but there is no proven solution yet. Therefore the best approach for now is to do full page reloads. If you keep your stories to specific states of components (which we would recommend anyways) this usually means it is fast.
30
-
31
- # Setup es6/7 dependencies
32
-
33
- By default storybook only works with precompiled ES5 code but as most web components themselves and their libs are distributed as ES2017 you will need to manually mark those packages as "needs transpilation".
34
-
35
- For example if you have a library called `my-library` which is in ES2017 then you can add it like so
36
-
37
- ```js
38
- // .storybook/main.js
39
-
40
- export default {
41
- webpackFinal: async (config) => {
42
- // find web-components rule for extra transpilation
43
- const webComponentsRule = config.module.rules.find(
44
- (rule) => rule.use && rule.use.options && rule.use.options.babelrc === false
45
- );
46
- // add your own `my-library`
47
- webComponentsRule.test.push(new RegExp(`node_modules(\\/|\\\\)my-library(.*)\\.js$`));
48
-
49
- return config;
50
- },
51
- };
52
- ```
53
-
54
- By default the following folders are included
55
-
56
- - `src/*.js`
57
- - `packages/*/src/*.js`
58
- - `node_modules/lit-html/*.js`
59
- - `node_modules/lit-element/*.js`
60
- - `node_modules/@open-wc/*.js`
61
- - `node_modules/@polymer/*.js`
62
- - `node_modules/@vaadin/*.js`
63
-
64
- As you can see the `src` folder is also included.
65
- The reason for that is as it has some extra configuration to allow for example `import.meta`.
66
- If you use a different folder you will need to make sure webpack/babel can handle it.
67
-
68
- # FAQ
69
-
70
- - While working on my component I get the error `Failed to execute 'define' on 'CustomElementRegistry': the name "..." has already been used with this registry`
71
- => please see <a href="#user-content-setup-page-reload-via-hmr">Setup page reload via HMR</a>
3
+ See [documentation](https://storybook.js.org/docs/8.0/get-started/web-components-webpack5?renderer=web-components) for installation instructions, usage examples, APIs, and more.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/web-components-webpack5",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "Storybook for web-components: View web components snippets in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "lit",
@@ -50,9 +50,9 @@
50
50
  "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
51
51
  },
52
52
  "dependencies": {
53
- "@storybook/builder-webpack5": "8.0.0",
54
- "@storybook/core-common": "8.0.0",
55
- "@storybook/web-components": "8.0.0",
53
+ "@storybook/builder-webpack5": "8.0.1",
54
+ "@storybook/core-common": "8.0.1",
55
+ "@storybook/web-components": "8.0.1",
56
56
  "@types/node": "^18.0.0"
57
57
  },
58
58
  "devDependencies": {