-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Support for lit-element with storybook/polymer #4958
Comments
There are reasons to make a separate config:
The only breaking change in the polyfill is that 1.x includes HTML imports polyfill, which is no longer needed by Polymer 3 and LitElement. Also, version 2.x of the polyfill brings own Symbol polyfill instead, but it should not conflict with those from |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I will work on this issue, please don't close 😁 |
yes it would probably nice to have a separate distribution... something that could be smaller and does not need the maybe call it I think a whitelist on what to compile will always be in the realm of the users themselves => but there should definitely be a good docu about it. |
|
Now when LitElement stable version is released, it makes sense to work on that so we could get this into the 5.0.0 storybook release. @ndelangen I'm going to work on this and start by adapting the code from
Could you briefly describe what parts do I need to cover, apart from these changes? Also, note that possible alternative would be to drop Polymer 2 and incorporate LitElement into Polymer package, and make sure that only Polymer 3 + LitElement are supported. This makes sense because of the fact that Polymer 3 and LitElement use the same versions of web components polyfills, the story setup can be shared, etc. |
+1, we are creating a new storybook with lit-element right now and are welcome to contribute. |
I suggest:
Example: button.js component
Story:
|
Hurrah!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.0-beta.2 containing PR #5490 that references this issue. Upgrade today to try it out! Because it's a pre-release you can find it on the Closing this issue. Please re-open if you think there's still more to do. |
@shilman that PR was only one prerequisite. I can try to refactor |
Sounds logical @web-padawan, reopening this issue for you guys. |
@Keraito thanks for reopening. Could you also help me with clarifying some details about how can we tweak webpack setup used by Storybook? I have created a very basic example of the webpack + web components here: So the steps I would like to configure are described below:
module: {
rules: [
{
test: /\.js$/,
use: [
BabelMultiTargetPlugin.loader()
]
}
]
},
new BabelMultiTargetPlugin({
babel: {
// @babel/preset-env options common for all bundles
presetOptions: {
useBuiltIns: 'usage'
}
},
// Target browsers with and without ES modules support
targets: {
es6: {
browsers: [
'last 2 Chrome major versions',
'last 2 ChromeAndroid major versions',
'last 2 Edge major versions',
'last 2 Firefox major versions',
'last 3 Safari major versions',
'last 3 iOS major versions'
],
tagAssetsWithKey: false, // don’t append a suffix to the file name
esModule: true // marks the bundle used with <script type="module">
},
es5: {
browsers: ['ie 11'],
tagAssetsWithKey: true, // append a suffix to the file name
noModule: true // marks the bundle included without `type="module"`
}
}
}) That's basically all that we need to get ES module build for evergreen browsers + ES5 build for "nomodule" browsers, especially IE11 which is still around. Also this would fix #3497 Is this feasible to achieve by tweaking framework preset only? Or the changes of this kind should be considered as part of Storybook core? I would like to hear your feedback about this feature. UPD: submitted #5531 as this makes sense to discuss as a separate feature request. |
Unfortunately I'm not the best person to ask webpack related issues, tagging @igor-borisov for you, who should have more knowledge in this domain |
@igor-dv 👆 Do you know? |
@web-padawan looking at what that plugin does, I think that's something we want in the core itself, so all frameworks can benefit from choosing to either run in a modern environment or a legacy one. Can we schedule a online meeting to discuss perhaps? |
@ndelangen thanks for taking a look! Let's continue discussion in #5531 |
@web-padawan Please join our discord if you can, I'm super active there. When would you be available? |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
@web-padawan any movement on this? seems like there are a lot of people lined up to use it! |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I'm still interested in this issue and hopefully will have time to finally work on it soon. |
Have you looked at the open-wc tool? they have a feature to use storybooks with lit-element |
Sure, I actually use that. It's based on |
@web-padawan Really excited to see this get in |
@web-padawan @emilio-martinez @hipstersmoothie @jackblackCH @chhschou @jokin I'd like to kick this off for realz this time, and get a group together passionate about this. I'll open a zoom:
Jun 13, 2019 8:00 PM GMT Hope you can join, feel free to join late, I'll keep it open. The agenda is:
|
just saw this thread. this is exciting! any outcome from the meeting? |
As a user of lit-element and one looking for easy auto documentation solutions, I am very excited to see this addressed ASAP. |
I have been working towards this behind the scenes. The main issue I haven't been able to address fully is HMR support, although some might argue it's a bit of a stretch in the web component space given how 'customElements.define' behaves currently. I'll try to wrap the work I've done into a PR soon. |
HMR works fine for us in the current implementation :) what seems to be the problem? we advocate for splitting class code and imho this could be a valid requirement if you want HMR |
Is there any progress on this? We are looking eagerly to try this out! |
@Ehofas I too am eagerly awaiting this, but if you're looking to use storybook with lit-element now you can follow the setup at open-wc.
|
@daKmoR Any plan to this? Starting a project with Lit-Elements. So, can I follow the tutorials at open-wc for lit-elements or will something change when this is released? Thanks in advance. Btw, Amazing work with Storybook! It is something which the community really wanted! |
@emilio-martinez any update on this? This issue is marked as "in progress" so I'm wondering whether there is any actual progress. |
@web-padawan Yes you can see @lonyele 's first draft here #7731 |
Please see #7084 (comment) for a working webpack config, if it's still relevant |
Is your feature request related to a problem? Please describe.
lit-element
seems to be the next evolution of polymer, but using the @storybook/polymer package withlit-element
is not working out of the box.Describe the solution you'd like
There is a little configuration that must be added in the webpack config file in order to make the storybook work with
lit-element
.Describe alternatives you've considered
You may override the webpack configuration yourself (in the
.storybook/webpack.config.js
file) with:Are you able to assist bring the feature to reality?
The solution is to add the previous exclude line directly in the webpack configuration.
Additional context
The exclude regexp may contain more elements like
/node_modules\/(?!(@webcomponents\/shadycss|lit-html|@polymer|@vaadin|@lit)\/).*/
(discussion here: lit/lit-element#54 (comment)).The text was updated successfully, but these errors were encountered: