Hi, Me and Claude have struggled to get a cordova build to work on my android device (all good for the web app…eventually). It seems like the entry app code is simply not getting invoked.
Any ideas? Here’s what Claude thinks might be relevant:
Description:
- Meteor 3.4 with rspack integration and “modern”: true
- Cordova Android builds bundle HTML templates but not the client/main.js entry point code
- The auto-generated client-meteor.js in the Cordova bundle only has template imports, no actual application JavaScript
- This causes the app to load but never execute any application code
- mainModule is correctly configured in package.json but ignored for web.cordova architecture
To Reproduce:
- Create a Meteor 3.4 project with rspack and “modern”: true
- Add mainModule config to package.json
- Build for Cordova: meteor run android-device
- Check .meteor/local/cordova-build/www/application/app/app.js - client/main.js code is missing
Expected: The bundled app.js should include the rspack-generated JavaScript code from client/main.js
Actual: Only HTML templates are bundled, no application JavaScript code
And further, my Rspack.config.js reads:
const { defineConfig } = require('@meteorjs/rspack');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
/**
* Rspack configuration for Meteor projects.
*
* Provides typed flags on the `Meteor` object, such as:
* - `Meteor.isClient` / `Meteor.isServer`
* - `Meteor.isDevelopment` / `Meteor.isProduction`
* - …and other flags available
*
* Use these flags to adjust your build settings based on environment.
*/
module.exports = defineConfig(Meteor => {
const config = {
devtool: Meteor.isDevelopment ? 'cheap-module-source-map' : false,
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: 'sass-loader',
options: {
// Dart Sass
implementation: require('sass'),
sourceMap: Meteor.isDevelopment,
sassOptions: {
// Suppress deprecation warnings from Bootstrap Sass and other legacy SCSS
silenceDeprecations: [
'import', // @import rules
'slash-div', // / division operator
'color-functions', // lighten(), darken(), etc.
'global-builtin', // Global built-in functions
'if-function', // if() function syntax
],
},
},
},
],
type: 'css',
},
],
},
plugins: [
// Add Node.js polyfills for browser builds
...(Meteor.isClient ? [new NodePolyfillPlugin()] : []),
// Bundle analyzer - run with RSDOCTOR=true meteor
...(process.env.RSDOCTOR && Meteor.isClient ? [
new (require('@rsdoctor/rspack-plugin').RsdoctorRspackPlugin)()
] : []),
],
resolve: {
fallback: Meteor.isClient ? {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer/'),
} : {},
},
};
// Enable HMR in development
if (Meteor.isDevelopment && Meteor.isClient) {
config.devServer = {
hot: true,
};
}
// Add server-specific externals for native modules
if (Meteor.isServer) {
// Use function-based externals for more control
config.externals = [
function({ request }, callback) {
// Externalize zlib-sync and any .node files
if (request === 'zlib-sync' || /\.node$/.test(request)) {
return callback(null, 'commonjs ' + request);
}
callback();
}
];
}
return config;
});
