diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index d5e6aae24b9..e5dd6766ffc 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -19,6 +19,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const getClientEnvironment = require('./env'); const paths = require('./paths'); +const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); // Webpack uses `publicPath` to determine where the app is being served from. // In development, we always serve from the root. This makes config easier. @@ -123,6 +124,7 @@ module.exports = { // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), + new TsconfigPathsPlugin({configFile: paths.appTsConfig}) ], }, module: { diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index d407f480f4e..72c73d43335 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -20,6 +20,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const paths = require('./paths'); const getClientEnvironment = require('./env'); +const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); // Webpack uses `publicPath` to determine where the app is being served from. // It requires a trailing slash, or the file assets will get an incorrect path. @@ -129,6 +130,7 @@ module.exports = { // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), + new TsconfigPathsPlugin({configFile: paths.appTsConfig}) ], }, module: { diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index a18a7008f02..1b410744a21 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -43,6 +43,7 @@ "sw-precache-webpack-plugin": "0.11.4", "ts-jest": "^20.0.7", "ts-loader": "^2.3.7", + "tsconfig-paths-webpack-plugin": "^2.0.0", "tslint": "^5.7.0", "tslint-loader": "^3.5.3", "tslint-react": "^3.2.0",