diff --git a/packages/cypress/package.json b/packages/cypress/package.json index bc85d730811f4a..64a4f7f1fa78fe 100644 --- a/packages/cypress/package.json +++ b/packages/cypress/package.json @@ -38,6 +38,7 @@ "@angular-devkit/architect": "0.803.3", "@angular-devkit/core": "8.3.3", "@cypress/webpack-preprocessor": "~4.1.0", + "fork-ts-checker-webpack-plugin": "^0.4.9", "tree-kill": "1.2.1", "ts-loader": "5.3.1", "tsconfig-paths-webpack-plugin": "3.2.0", diff --git a/packages/cypress/src/plugins/preprocessor.ts b/packages/cypress/src/plugins/preprocessor.ts index ea38af6c13095e..364a997f14b745 100644 --- a/packages/cypress/src/plugins/preprocessor.ts +++ b/packages/cypress/src/plugins/preprocessor.ts @@ -2,6 +2,8 @@ import * as wp from '@cypress/webpack-preprocessor'; import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin'; import * as nodeExternals from 'webpack-node-externals'; +import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); + export function preprocessTypescript(config: any) { if (!config.env.tsConfig) { throw new Error( @@ -35,11 +37,18 @@ export function getWebpackConfig(config: any) { options: { configFile: config.env.tsConfig, // https://github.com/TypeStrong/ts-loader/pull/685 - experimentalWatchApi: true + experimentalWatchApi: true, + // https://github.com/cypress-io/cypress/issues/2316 + transpileOnly: true } } ] }, + plugins: [ + new ForkTsCheckerWebpackPlugin({ + tsconfig: config.env.tsConfig + }) + ], externals: [nodeExternals()] }; }