mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-12 22:46:30 +08:00
Adds the configuration for PnP/Typescript (#6856)
* Adds the configuration for PnP/Typescript * Adds the header * Bumps ts-pnp * Bumps fork-ts-checker-webpack-plugin
This commit is contained in:
committed by
Ian Sutherland
parent
6710f52110
commit
b36d1ea1aa
@@ -59,7 +59,7 @@
|
||||
"escape-string-regexp": "1.0.5",
|
||||
"filesize": "3.6.1",
|
||||
"find-up": "3.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "1.0.1",
|
||||
"fork-ts-checker-webpack-plugin": "1.1.1",
|
||||
"global-modules": "2.0.0",
|
||||
"globby": "8.0.2",
|
||||
"gzip-size": "5.0.0",
|
||||
|
||||
43
packages/react-scripts/config/pnpTs.js
vendored
Normal file
43
packages/react-scripts/config/pnpTs.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
// @remove-on-eject-begin
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// @remove-on-eject-end
|
||||
'use strict';
|
||||
|
||||
const { resolveModuleName } = require('ts-pnp');
|
||||
|
||||
exports.resolveModuleName = (
|
||||
typescript,
|
||||
moduleName,
|
||||
containingFile,
|
||||
compilerOptions,
|
||||
resolutionHost
|
||||
) => {
|
||||
return resolveModuleName(
|
||||
moduleName,
|
||||
containingFile,
|
||||
compilerOptions,
|
||||
resolutionHost,
|
||||
typescript.resolveModuleName
|
||||
);
|
||||
};
|
||||
|
||||
exports.resolveTypeReferenceDirective = (
|
||||
typescript,
|
||||
moduleName,
|
||||
containingFile,
|
||||
compilerOptions,
|
||||
resolutionHost
|
||||
) => {
|
||||
return resolveModuleName(
|
||||
moduleName,
|
||||
containingFile,
|
||||
compilerOptions,
|
||||
resolutionHost,
|
||||
typescript.resolveTypeReferenceDirective
|
||||
);
|
||||
};
|
||||
@@ -637,6 +637,12 @@ module.exports = function(webpackEnv) {
|
||||
async: isEnvDevelopment,
|
||||
useTypescriptIncrementalApi: true,
|
||||
checkSyntacticErrors: true,
|
||||
resolveModuleNameModule: process.versions.pnp
|
||||
? `${__dirname}/pnpTs.js`
|
||||
: undefined,
|
||||
resolveTypeReferenceDirectiveModule: process.versions.pnp
|
||||
? `${__dirname}/pnpTs.js`
|
||||
: undefined,
|
||||
tsconfig: paths.appTsConfig,
|
||||
reportFiles: [
|
||||
'**',
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"semver": "6.0.0",
|
||||
"style-loader": "0.23.1",
|
||||
"terser-webpack-plugin": "1.2.3",
|
||||
"ts-pnp": "1.1.2",
|
||||
"url-loader": "1.1.2",
|
||||
"webpack": "4.29.6",
|
||||
"webpack-dev-server": "3.2.1",
|
||||
|
||||
Reference in New Issue
Block a user