|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | module.exports = { |
4 | | - modify(baseConfig, { target, dev }, webpack) { |
5 | | - const config = Object.assign({}, baseConfig); |
6 | | - |
7 | | - config.resolve.extensions = config.resolve.extensions.concat([ |
8 | | - '.ts', |
9 | | - '.tsx', |
10 | | - ]); |
11 | | - |
12 | | - |
13 | | - |
14 | | - // Locate eslint-loader and remove it (we're using tslint instead) |
15 | | - config.module.rules = config.module.rules.filter( |
16 | | - rule => |
17 | | - !( |
18 | | - Array.isArray(rule.use) && |
19 | | - rule.use.length > 0 && |
20 | | - rule.use[0].options && |
21 | | - 'useEslintrc' in rule.use[0].options |
22 | | - ) |
23 | | - ); |
24 | | - // Add tslint-loader |
25 | | - config.module.rules.push({ |
26 | | - include, |
27 | | - enforce: 'pre', |
28 | | - test: /\.tsx?$/, |
29 | | - loader: 'tslint-loader', |
30 | | - options: { |
31 | | - emitErrors: true, |
32 | | - configFile: './tslint.json', |
33 | | - }, |
34 | | - }); |
35 | | - |
36 | | - // Safely locate Babel-Loader in Razzle's webpack internals |
37 | | - const babelLoader = config.module.rules.findIndex( |
38 | | - rule => rule.use[1].options && rule.use[1].options.babelrc |
39 | | - ); |
40 | | - |
41 | | - // Get the correct `include` option, since that hasn't changed. |
42 | | - // This tells Razzle which directories to transform. |
43 | | - const { include } = config.module.rules[babelLoader]; |
44 | | - |
45 | | - // Declare our TypeScript loader configuration |
46 | | - const tsLoader = { |
47 | | - include, |
48 | | - test: /\.tsx?$/, |
49 | | - loader: 'ts-loader', |
50 | | - options: { |
51 | | - transpileOnly: true, |
52 | | - }, |
53 | | - }; |
54 | | - // Add loader |
55 | | - config.module.rules.push(tsLoader) |
56 | | - |
57 | | - // Additional options found at https://github.com/TypeStrong/ts-loader#faster-builds |
58 | | - // Add async typechecking errors |
59 | | - // config.plugins.push(new require('fork-ts-checker-webpack-plugin')()) |
60 | | - |
61 | | - // If you want to replace Babel with typescript to fully speed up build |
62 | | - // then do the following: |
63 | | - // |
64 | | - // - COMMENT out line 55 |
65 | | - // - UNCOMMENT line 67 |
66 | | - // |
67 | | - // config.module.rules[babelLoader] = tsLoader; |
68 | | - |
69 | | - return config; |
70 | | - }, |
| 4 | + plugins: ['typescript'], |
71 | 5 | }; |
0 commit comments