diff --git a/packages/rspack/rspack_plugin.js b/packages/rspack/rspack_plugin.js index f98f9b1483..42edc161b4 100644 --- a/packages/rspack/rspack_plugin.js +++ b/packages/rspack/rspack_plugin.js @@ -43,7 +43,7 @@ const { const { setupCompilationTracking, - waitForFirstCompilation + waitForFirstCompilation, } = require('./lib/compilation'); const { @@ -62,6 +62,7 @@ const { isMeteorAppProduction, isMeteorAppDebug, isMeteorAppConfigModernVerbose, + isMeteorAppNative, } = require('meteor/tools-core/lib/meteor'); const { @@ -123,7 +124,7 @@ if (isMeteorAppRun() || isMeteorAppBuild() || isMeteorAppTest()) { } = setupCompilationTracking(); // For 'run' command, start Rspack in appropriate modes with distinct callbacks - if (isMeteorAppDevelopment()) { + if (isMeteorAppDevelopment() || !isMeteorAppNative()) { startRspackClientServe({ onCompile: onCompileClient }); startRspackServerWatch({ onCompile: onCompileServer }); } else if (isMeteorAppProduction()) { diff --git a/packages/tools-core/lib/meteor.js b/packages/tools-core/lib/meteor.js index e23945f216..03a09cc448 100644 --- a/packages/tools-core/lib/meteor.js +++ b/packages/tools-core/lib/meteor.js @@ -183,6 +183,32 @@ export function isMeteorAppTestWatch() { return isMeteorAppTest() && !Package?.meteor?.global?.currentCommand?.options?.once; } +/** + * Check if the current Meteor current command is running Android. + * @returns {boolean} + */ +export function isMeteorAppNativeAndroid() { + return Package?.meteor?.global?.currentCommand?.options?.['android-device'] || + Package?.meteor?.global?.currentCommand?.options?.['android']; +} + +/** + * Check if the current Meteor current command is running iOS. + * @returns {boolean} + */ +export function isMeteorAppNativeIos() { + return Package?.meteor?.global?.currentCommand?.options?.['ios-device'] || + Package?.meteor?.global?.currentCommand?.options?.['ios']; +} + +/** + * Checks if the current Meteor command is running native. + * @returns {boolean} + */ +export function isMeteorAppNative() { + return isMeteorAppNativeAndroid() || isMeteorAppNativeIos(); +} + /** * Checks if the Meteor application is running in development mode. * @returns {boolean} True if the application is in development mode, false otherwise.