Skip to content

Commit

Permalink
ci: ensure that webpack too doesn't include test/mock/specs files (#452)
Browse files Browse the repository at this point in the history
Signed-off-by: Nastya Rusina <[email protected]>
  • Loading branch information
anrusina committed May 18, 2022
1 parent 5b44539 commit 560b645
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
6 changes: 1 addition & 5 deletions packages/zapp/console/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"]
}
20 changes: 16 additions & 4 deletions packages/zapp/console/webpack.common.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 560b645

Please sign in to comment.