Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

fix: handle types check in a child process #926

Merged
merged 1 commit into from
Jun 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions templates/webpack.typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ module.exports = env => {
loader: "ts-loader",
options: {
configFile: tsConfigPath,
transpileOnly: !!hmr,
// https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
// https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
transpileOnly: true,
allowTsInNodeModules: true,
compilerOptions: {
sourceMap: isAnySourceMapEnabled,
Expand Down Expand Up @@ -256,6 +258,14 @@ module.exports = env => {
}),
// Does IPC communication with the {N} CLI to notify events when running in watch mode.
new nsWebpack.WatchStateLoggerPlugin(),
// https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
// https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
new ForkTsCheckerWebpackPlugin({
tsconfig: tsConfigPath,
async: false,
useTypescriptIncrementalApi: true,
memoryLimit: 4096
})
],
};

Expand Down Expand Up @@ -295,12 +305,6 @@ module.exports = env => {

if (hmr) {
config.plugins.push(new webpack.HotModuleReplacementPlugin());

// With HMR ts-loader should run in `transpileOnly` mode,
// so assure type-checking with fork-ts-checker-webpack-plugin
config.plugins.push(new ForkTsCheckerWebpackPlugin({
tsconfig: tsConfigPath
}));
}


Expand Down