File size: 990 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
const path = require('path');
const { compilerOptions } = require('../tsconfig.json');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

const basedir = path.join(__dirname, '..');

module.exports = async ({ config, mode }) => {
  config.module.rules.push(
    {
      test: /\.md?$/,
      loader: "markdown-loader",
    },
    {
      test: /\.tsx?$/,
      loader: 'ts-loader',
      include: [
        path.join(basedir, 'src'),
        path.join(basedir, 'stories'),
      ],
      options: {
        transpileOnly: true, // use transpileOnly mode to speed-up compilation
        compilerOptions: {
          ...compilerOptions,
          declaration: false,
        },
      },
    },
  );

  config.plugins.push(new ForkTsCheckerWebpackPlugin());

  config.resolve.extensions = ['.ts', '.tsx', '.js', '.jsx'];
  config.resolve.enforceExtension = false;

  // disable the hint about too big bundle
  config.performance.hints = false;

  return config;
};