main.js 1.32 KB
Newer Older
zhanghaozhe committed
1 2
const postcssNormalize = require("postcss-normalize")
const path = require("path")
zhanghaozhe committed
3 4

module.exports = {
zhanghaozhe committed
5
  stories: ["../src/common/**/*.stories.tsx"],
zhanghaozhe committed
6 7
  addons: [
    {
zhanghaozhe committed
8
      name: "@storybook/preset-typescript",
zhanghaozhe committed
9 10
      options: {
        tsLoaderOptions: {
zhanghaozhe committed
11
          configFile: path.resolve(__dirname, "../tsconfig.json"),
zhanghaozhe committed
12 13 14
        },
      },
    },
zhanghaozhe committed
15 16 17
    "@storybook/addon-actions",
    "@storybook/addon-links",
    "@storybook/addon-knobs",
zhanghaozhe committed
18
  ],
zhanghaozhe committed
19
  webpackFinal: async (config) => {
zhanghaozhe committed
20 21 22
    config.module.rules.push({
      test: /\.scss$/,
      use: [
zhanghaozhe committed
23 24
        "style-loader",
        "css-loader",
zhanghaozhe committed
25
        {
zhanghaozhe committed
26
          loader: require.resolve("postcss-loader"),
zhanghaozhe committed
27
          options: {
zhanghaozhe committed
28
            ident: "postcss",
zhanghaozhe committed
29
            plugins: () => [
zhanghaozhe committed
30 31
              require("postcss-flexbugs-fixes"),
              require("postcss-preset-env")({
zhanghaozhe committed
32
                autoprefixer: {
zhanghaozhe committed
33
                  flexbox: "no-2009",
zhanghaozhe committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47
                },
                stage: 3,
              }),
              /*require('postcss-px-to-viewport')({
                viewportWidth: 375,
                unitPrecision: 6,
                selectorBlackList: ['skip-vw'],
              }),*/
              postcssNormalize(),
            ],
            sourceMap: false,
          },
        },
        {
zhanghaozhe committed
48
          loader: "sass-loader",
zhanghaozhe committed
49 50 51
        },
      ],
    })
zhanghaozhe committed
52
    return config
zhanghaozhe committed
53
  },
zhanghaozhe committed
54
}