1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| const path = require('path') const fs = require('fs') const appDirectory = fs.realpathSync(process.cwd()) module.exports = { plugins: [ ], resolve: { extensions: ['', '.js', '.jsx', '.ts', '.tsx'] }, module: { rules: [ { test: /\.(mjs|jsx?)$/, use: [ { loader: require.resolve('babel-loader'), options: { cacheDirectory: path.join( appDirectory, '/node_modules/.cache/storybook' ), babelrc: false, plugins: [ [ require.resolve('babel-plugin-react-docgen'), { DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES' } ] ] } } ], include: [appDirectory], exclude: [path.join(appDirectory, '/node_modules')] }, { test: /\.(ts|tsx)$/, loader: require.resolve('ts-loader') }, { test: /\.md$/, use: [ { loader: require.resolve('raw-loader') } ] }, { test: /\.(s*)css$/, sideEffects: true, use: [ require.resolve('style-loader'), { loader: require.resolve('css-loader'), options: { importLoaders: 1, modules: { localIdentName: '[local]___[hash:base64:5]' } } }, { loader: require.resolve('postcss-loader'), options: { ident: 'postcss', postcss: {}, syntax: 'postcss-scss', plugins: () => [ require('postcss-nested'), require('postcss-flexbugs-fixes'), require('postcss-preset-env')({ autoprefixer: { flexbox: 'no-2009' }, stage: 3 }), require('postcss-aspect-ratio-mini'), require('postcss-write-svg')({ utf8: false }), require('postcss-px-to-viewport')({ viewportWidth: 750, viewportHeight: 1334, unitPrecision: 3, viewportUnit: 'vw', selectorBlackList: ['.ignore', '.hairlines'], minPixelValue: 1, mediaQuery: false }), require('postcss-viewport-units'), require('cssnano')({ preset: [ 'advanced', { reduceIdents: false, zindex: false } ], autoprefixer: false, 'postcss-zindex': false }) ] } } ] }, { test: /\.(svg|ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|cur|ani)(\?.*)?$/, loader: require.resolve('file-loader'), query: { name: 'static/media/[name].[hash:8].[ext]' } }, { test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, loader: require.resolve('url-loader'), query: { limit: 10000, name: 'static/media/[name].[hash:8].[ext]' } }, { test: /\.stories\.[j|t]sx?$/, loaders: [require.resolve('@storybook/source-loader')], enforce: 'pre' } ] } }
|