Skip to content

Commit d5b370d

Browse files
committed
Fixed problem with tsconfig.json baseUrl and paths
1 parent 22e52e1 commit d5b370d

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
2121
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2222
const getClientEnvironment = require('./env');
2323
const paths = require('./paths');
24+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
2425

2526
// Webpack uses `publicPath` to determine where the app is being served from.
2627
// In development, we always serve from the root. This makes config easier.
@@ -126,6 +127,7 @@ module.exports = {
126127
// please link the files into your node_modules/ and let module-resolution kick in.
127128
// Make sure your source files are compiled, as they will not be processed in any way.
128129
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
130+
new TsconfigPathsPlugin({configFile: paths.appTsConfig})
129131
],
130132
},
131133
module: {

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
2222
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2323
const paths = require('./paths');
2424
const getClientEnvironment = require('./env');
25+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
2526

2627
// Webpack uses `publicPath` to determine where the app is being served from.
2728
// It requires a trailing slash, or the file assets will get an incorrect path.
@@ -130,6 +131,7 @@ module.exports = {
130131
// please link the files into your node_modules/ and let module-resolution kick in.
131132
// Make sure your source files are compiled, as they will not be processed in any way.
132133
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
134+
new TsconfigPathsPlugin({configFile: paths.appTsConfig})
133135
],
134136
},
135137
module: {

packages/react-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"style-loader": "0.18.2",
4141
"ts-jest": "^20.0.7",
4242
"ts-loader": "^2.3.7",
43+
"tsconfig-paths-webpack-plugin": "^2.0.0",
4344
"tslint": "^5.7.0",
4445
"tslint-loader": "^3.5.3",
4546
"tslint-react": "^3.2.0",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy