Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: ensure that webpack too doesn't include test/mock/specs files #452

Merged
merged 1 commit into from
May 6, 2022
Merged
Show file tree
Hide file tree
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
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