Giter VIP home page Giter VIP logo

storybook-addon-swc's Introduction

storybook-addon-swc

npm version codecov license Github Twitter

Storybook addon that improves build time by building with swc.

๐Ÿ—’ Examples

๐Ÿš€ Installation

$ npm install -D storybook-addon-swc @swc/core

๐Ÿ‘ Getting Started

Edit the .storybook/main.js file and register the addon.

module.exports = {
  addons: [
    'storybook-addon-swc',
  ],
};

๐Ÿ”ง Configurations

Additional configuration options can be passed as needed.

module.exports = {
  addons: [
    {
      name: 'storybook-addon-swc',
      options: {
        enable: true,
        enableSwcLoader: true,
        enableSwcMinify: true,
        swcLoaderOptions: {},
        swcMinifyOptions: {},
      },
    },
  ],
};

Options

Name Description Type Default Value
enable If set to false, this add-on will be disabled. boolean true
enableSwcLoader If set to false, swc-loader is disabled and babel-loader is used. boolean true
enableSwcMinify If set to false, minify using swc is disabled and minify using conventional terser is used. boolean true
swcLoaderOptions Options for swc loader. object see
swcMinifyOptions Options for swc minify. object see

SWC Plugins

The SWC plugins feature is still experimental, but can be used by changing the settings as follows.

module.exports = {
  addons: [
    {
      name: 'storybook-addon-swc',
      options: {
        swcLoaderOptions: {
          jsc: {
            experimental: {
              plugins: [['plugin-name', {}]],
            },
          },
        },
      },
    },
  ],
};

๐ŸŽ“ Alternative

This add-on replaces babel-loader with esbuild-loader.
It was used as a reference in the development of storybook-addon-swc.

This builder changes the build system of Storybook from Webpack to Vite.
Vite is very fast because it does not bundle during development.

๐Ÿค Contributing

Contributions, issues and feature requests are welcome.

Feel free to check issues page if you want to contribute.

๐Ÿ“ License

Copyright ยฉ 2020 @Karibash.

This project is MIT licensed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.