Skip to content

Commit d49e5d4

Browse files
authored
Allow skipping wheels bundle (#561)
1 parent 5f810cb commit d49e5d4

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

‎webpack.config.js‎

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function generateExternals() {
5757

5858
const EXTERNALS = generateExternals();
5959

60-
function createPlugins(isDevelopment, outputPath, mode, env, rebuild = false, buildTarget = '') {
60+
function createPlugins(isDevelopment, outputPath, mode, env, rebuild = false, buildTarget = '', skipWheels = false) {
6161
const plugins = [];
6262

6363
plugins.push(
@@ -69,21 +69,25 @@ function createPlugins(isDevelopment, outputPath, mode, env, rebuild = false, bu
6969
);
7070

7171
// Download Python wheels at build time so they don't need to be committed to git
72-
plugins.push({
73-
apply: (compiler) => {
74-
compiler.hooks.beforeRun.tapAsync('DownloadWheels', (_compilation, callback) => {
75-
try {
76-
console.log('[DownloadWheels] Downloading Python wheels...');
77-
execSync('npm run download-wheels', { cwd: __dirname, stdio: 'inherit' });
78-
console.log('[DownloadWheels] Done');
79-
callback();
80-
} catch (error) {
81-
console.error('[DownloadWheels] Error:', error);
82-
callback(error);
83-
}
84-
});
85-
},
86-
});
72+
if (!skipWheels) {
73+
plugins.push({
74+
apply: (compiler) => {
75+
compiler.hooks.beforeRun.tapAsync('DownloadWheels', (_compilation, callback) => {
76+
try {
77+
console.log('[DownloadWheels] Downloading Python wheels...');
78+
execSync('npm run download-wheels', { cwd: __dirname, stdio: 'inherit' });
79+
console.log('[DownloadWheels] Done');
80+
callback();
81+
} catch (error) {
82+
console.error('[DownloadWheels] Error:', error);
83+
callback(error);
84+
}
85+
});
86+
},
87+
});
88+
} else {
89+
console.log('[DownloadWheels] Skipped (skipWheels=true)');
90+
}
8791

8892
// Copy relationship schemas for both development and production
8993
plugins.push(
@@ -295,6 +299,7 @@ module.exports = (env = {}) => {
295299
let awsEnv = env.env;
296300
const rebuild = env.rebuild === 'true' || env.rebuild === true;
297301
const buildTarget = env.buildTarget || '';
302+
const skipWheels = env.skipWheels === 'true' || env.skipWheels === true;
298303

299304
// Validate mode
300305
const validModes = ['development', 'production'];
@@ -320,7 +325,7 @@ module.exports = (env = {}) => {
320325
console.info(`Building server with mode: ${mode}`);
321326
console.info(`NODE_ENV: ${mode}`);
322327
console.info(`AWS_ENV: ${awsEnv}`);
323-
console.info(`Platform: ${process.platform}, Arch: ${process.arch}, Rebuild: ${rebuild}`);
328+
console.info(`Platform: ${process.platform}, Arch: ${process.arch}, Rebuild: ${rebuild}, SkipWheels: ${skipWheels}`);
324329
console.info(`Node.js ${process.version}, Versions: ${JSON.stringify(process.versions, null, 2)}`);
325330
console.info(`Output path: ${outputPath}`);
326331

@@ -348,6 +353,6 @@ module.exports = (env = {}) => {
348353
chunks: 'all',
349354
},
350355
},
351-
plugins: createPlugins(isDevelopment, outputPath, mode, awsEnv, rebuild, buildTarget),
356+
plugins: createPlugins(isDevelopment, outputPath, mode, awsEnv, rebuild, buildTarget, skipWheels),
352357
};
353358
};

0 commit comments

Comments
 (0)