Skip to content

Commit a8e18e2

Browse files
committed
Fix watch mode repeated ts compilation issue
1 parent 8ded8e9 commit a8e18e2

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

config/webpack.ssr.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const webpack = require('webpack');
44
const HtmlWebpackPlugin = require('html-webpack-plugin');
55
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
6+
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin-alt');
67
const nodeExternals = require('webpack-node-externals');
78
const webpackConfigFactory = require('./webpack.config.js');
89
const paths = require('./paths');
@@ -60,8 +61,11 @@ module.exports = function (webpackEnv) {
6061
// filter out some plugins
6162
plugins: template.plugins.filter(plugin =>
6263
[
64+
// seems to break multicompiler dev server watch mode
65+
ForkTsCheckerWebpackPlugin,
66+
// interpolation of '%PUBLIC_URL%' will happen at runtime, not compile time
6367
InterpolateHtmlPlugin,
64-
// filter out original DefinePlugin
68+
// this will be replaced by a modified version
6569
webpack.DefinePlugin
6670
].every(pluginClass => !(plugin instanceof pluginClass))
6771
).concat([

template-typescript/src/index.ssr.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ router.use(express.static(
3535
router.use((request: express.Request, response: express.Response, next: express.NextFunction) => {
3636
const template = readFileSync('build/index.html')
3737
.toString()
38-
.replace(/%PUBLIC_URL%/g, process.env.PUBLIC_URL || '')
38+
.replace(/%PUBLIC_URL%/g, process.env.PUBLIC_URL || '');
3939

4040
const [head, tail] = template.split('%ROOT%');
4141
const stream = renderToNodeStream(<App />);

template/src/index.ssr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ router.use(express.static(
3535
router.use((request, response, next) => {
3636
const template = readFileSync('build/index.html')
3737
.toString()
38-
.replace(/%PUBLIC_URL%/g, process.env.PUBLIC_URL || '')
38+
.replace(/%PUBLIC_URL%/g, process.env.PUBLIC_URL || '');
3939

4040
const [head, tail] = template.split('%ROOT%');
4141
const stream = renderToNodeStream(<App />);

0 commit comments

Comments
 (0)