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
  },

貢獻者指南