From 0b70a97d01eaf464a00d36b1064981511039ffc8 Mon Sep 17 00:00:00 2001 From: Nastya <55718143+anrusina@users.noreply.github.com> Date: Thu, 5 May 2022 19:40:19 -0700 Subject: [PATCH] ci: ensure that webpack too doesn't include test/mock/specs files (#452) Signed-off-by: Nastya Rusina --- packages/zapp/console/tsconfig.json | 6 +----- .../zapp/console/webpack.common.config.ts | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/zapp/console/tsconfig.json b/packages/zapp/console/tsconfig.json index 7a0b1db20..0e27291d2 100644 --- a/packages/zapp/console/tsconfig.json +++ b/packages/zapp/console/tsconfig.json @@ -12,9 +12,5 @@ "noImplicitOverride": false }, "references": [{ "path": "../../plugins/components" }], - "include": [ - "src/**/*", - // TODO: *.json could be removed when tsconfig.build.json would be properly consumed by webpack - "src/**/*.json" - ] + "include": ["src/**/*"] } diff --git a/packages/zapp/console/webpack.common.config.ts b/packages/zapp/console/webpack.common.config.ts index 9a31b6645..eebd81d8d 100644 --- a/packages/zapp/console/webpack.common.config.ts +++ b/packages/zapp/console/webpack.common.config.ts @@ -16,11 +16,15 @@ export const serviceName = process.env.SERVICE_NAME || 'not set'; /** Absolute path to webpack output folder */ export const dist = path.join(__dirname, 'dist'); +/** Absolute path to build specific tsconfig */ +export const configFile = path.resolve(__dirname, './tsconfig.build.json'); + // Report current configuration console.log(chalk.cyan('Exporting Webpack config with following configurations:')); console.log(chalk.blue('Environment:'), chalk.green(env.NODE_ENV)); console.log(chalk.blue('Output directory:'), chalk.green(path.resolve(dist))); console.log(chalk.blue('Public path:'), chalk.green(publicPath)); +console.log(chalk.yellow('TSconfig file used for build:'), chalk.green(configFile)); /** Adds sourcemap support */ export const sourceMapRule: webpack.RuleSetRule = { @@ -71,8 +75,12 @@ export const limitChunksPlugin = new webpack.optimize.LimitChunkCountPlugin({ const typescriptRule = { test: /\.tsx?$/, exclude: /node_modules/, - // include: path.resolve(__dirname, 'src'), // narusina - check with Carina as we need to remove it for micropackages structure - use: [{ loader: 'ts-loader', options: { transpileOnly: true } }], + loader: 'ts-loader', + options: { + configFile, + // disable type checker - as it's done by ForkTsCheckerWebpackPlugin + transpileOnly: true, + }, }; const resolve = { @@ -121,7 +129,7 @@ export const clientConfig: webpack.Configuration = { chunkFilename: '[name]-[chunkhash].chunk.js', }, plugins: [ - new ForkTsCheckerWebpackPlugin(), + new ForkTsCheckerWebpackPlugin({ typescript: { configFile } }), favIconPlugin, statsWriterPlugin, getDefinePlugin(false), @@ -149,7 +157,11 @@ export const serverConfig: webpack.Configuration = { libraryTarget: 'commonjs2', clean: true, }, - plugins: [limitChunksPlugin, new ForkTsCheckerWebpackPlugin(), getDefinePlugin(true)], + plugins: [ + limitChunksPlugin, + new ForkTsCheckerWebpackPlugin({ typescript: { configFile } }), + getDefinePlugin(true), + ], }; export const clientEnv = JSON.stringify(processEnv);