storybookjs/storybook

[Feature Request]: remove babel transformations in web-components-webpack preset

已关闭

#20,095 创建于 2022年12月5日

 (0 条评论) (0 个反应) (0 位负责人)TypeScript (10,058 个派生)batch import
help wantedmaintenanceweb-components

仓库指标

星标
 (89,909 个星标)
PR 合并指标
 (平均合并 7天 22小时) (30 天内合并 184 个 PR)

描述

Is your feature request related to a problem? Please describe

The web-components-webpack preset add some babel transformation by default to some specific libraries.

With storybook v7 they are not needed anymore and only increase complexity / build time:

  • supports import.meta.url: webpack 5 already supports it - https://webpack.js.org/api/module-variables/#importmetaurl . Even if not supported, this is not really needed to run web components in storybook or in general
  • transforms some libraries / packages (polymer, lit, vaadin): with v7 dropping support to ie does not makes sense anymore to transform such libraries. Also the selection of libraries is arbitrary / questionable: polymer is not a thing anymore. Why vaadin, a freemium product? Why not ui5, carbon, spectrum libraries - as good or better than vaadin?

Describe the solution you'd like

Remove babel transformations in web-components-webpack preset

Describe alternatives you've considered

Remove web-components-webpack preset

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

Even with storybook v6 this is not needed for those that target evergreen browsers. In my projects, i manually remove babel transformation:

 webpackFinal: async function (config) {
      const ruleIndex = config.module.rules.findIndex(
        (rule) => rule.use && rule.use.options && rule.use.options.babelrc === false
      )
      if (ruleIndex !== -1) {
        config.module.rules.splice(ruleIndex, 1)
      }     
    return config
  },

贡献者指南