|
1 |
| -const failPlugin = require('webpack-fail-plugin'); |
2 |
| -const path = require("path"); |
3 |
| -const include = path.resolve(__dirname, '../'); |
4 |
| - |
5 |
| -// you can use this file to add your custom webpack plugins, loaders and anything you like. |
6 |
| -// This is just the basic way to add addional webpack configurations. |
7 |
| -// For more information refer the docs: https://goo.gl/qPbSyX |
8 |
| - |
9 |
| -// IMPORTANT |
10 |
| -// When you add this file, we won't add the default configurations which is similar |
11 |
| -// to "React Create App". This only has babel loader to load JavaScript. |
12 |
| - |
13 |
| -module.exports = { |
14 |
| - devtool: 'source-map', |
15 |
| - entry: './stories/index.tsx', |
16 |
| - output: { |
17 |
| - filename: include + '/dist/examples/storybook.js' |
18 |
| - }, |
19 |
| - plugins: [ |
20 |
| - failPlugin |
21 |
| - ], |
22 |
| - resolve: { |
23 |
| - // Add `.ts` and `.tsx` as a resolvable extension. |
24 |
| - extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"] |
25 |
| - }, |
26 |
| - module: { |
27 |
| - loaders: [ |
28 |
| - { test: /\.tsx?$/, |
29 |
| - loader: 'babel-loader!ts-loader', |
30 |
| - exclude: /node_modules/, |
31 |
| - cacheDirectory: true, |
32 |
| - include, |
| 1 | +const path = require('path'); |
| 2 | +module.exports = (baseConfig, env, config) => { |
| 3 | + config.module.rules.push({ |
| 4 | + test: /\.(ts|tsx)$/, |
| 5 | + use: [ |
| 6 | + { loader: 'babel-loader' }, |
| 7 | + { |
| 8 | + loader: 'awesome-typescript-loader' |
| 9 | + }, |
| 10 | + { |
| 11 | + loader: 'react-docgen-typescript-loader' |
33 | 12 | }
|
34 |
| - ], |
35 |
| - }, |
36 |
| - ts: { |
37 |
| - compilerOptions: { |
38 |
| - noEmit: false, |
39 |
| - }, |
40 |
| - }, |
| 13 | + ] |
| 14 | + }); |
| 15 | + config.resolve.extensions.push('.ts', '.tsx'); |
| 16 | + return config; |
41 | 17 | };
|
0 commit comments