1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /* eslint-env node */
- import childProcess from 'node:child_process';
- import path from 'node:path';
- import webpack from 'webpack';
- import baseConfig from '../webpack.config';
- const commitHash =
- process.env.SENTRY_BUILD ||
- childProcess.execSync('git rev-parse HEAD').toString().trim();
- const findLoader = (loaderName: string) =>
- baseConfig.module?.rules?.find(
- rule =>
- rule &&
- typeof rule === 'object' &&
- typeof rule.use === 'object' &&
- !Array.isArray(rule.use) &&
- rule.use.loader === loaderName
- ) as webpack.RuleSetRule;
- const config: webpack.Configuration = {
- mode: baseConfig.mode,
- context: baseConfig.context,
- resolve: baseConfig.resolve,
- target: 'node',
- entry: {
- config: 'sentry/chartcuterie/config',
- },
- module: {
- rules: [findLoader('babel-loader'), findLoader('po-catalog-loader')],
- noParse: baseConfig.module?.noParse,
- },
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': {COMMIT_SHA: JSON.stringify(commitHash)},
- }),
- ],
- output: {
- path: path.join(__dirname, 'chartcuterie'),
- libraryTarget: 'commonjs2',
- },
- optimization: {minimize: false},
- };
- module.exports = config;
|