@meteorjs/rspack 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rspack.config.js +11 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteorjs/rspack",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Configuration logic for using Rspack in Meteor projects",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/rspack.config.js CHANGED
@@ -3,6 +3,7 @@ import fs from 'fs';
3
3
  import { createRequire } from 'module';
4
4
  import path from 'path';
5
5
  import { merge } from 'webpack-merge';
6
+ import { inspect } from "node:util";
6
7
 
7
8
  import { RequireExternalsPlugin } from './plugins/RequireExtenalsPlugin.js';
8
9
  import { getMeteorAppSwcConfig } from "./lib/swc.js";
@@ -182,6 +183,8 @@ export default function (inMeteor = {}, argv = {}) {
182
183
  : []),
183
184
  ];
184
185
 
186
+ const reactRefreshModule = isReactEnabled ? safeRequire('@rspack/plugin-react-refresh') : null;
187
+
185
188
  // Base client config
186
189
  let clientConfig = {
187
190
  name: 'meteor-client',
@@ -220,8 +223,8 @@ export default function (inMeteor = {}, argv = {}) {
220
223
  plugins: [
221
224
  ...(isRun
222
225
  ? [
223
- ...(isReactEnabled
224
- ? [new (safeRequire('@rspack/plugin-react-refresh'))()]
226
+ ...(isReactEnabled && reactRefreshModule
227
+ ? [new reactRefreshModule()]
225
228
  : []),
226
229
  new RequireExternalsPlugin({
227
230
  filePath: path.join(buildContext, runPath),
@@ -334,10 +337,11 @@ export default function (inMeteor = {}, argv = {}) {
334
337
  }
335
338
  }
336
339
 
337
- // Return the appropriate configuration
338
- if (isClient) {
339
- return [clientConfig];
340
+ const config = isClient ? clientConfig : serverConfig;
341
+
342
+ if (Meteor.isDebug) {
343
+ console.log('Config:', inspect(config, { depth: null, colors: true }));
340
344
  }
341
- // Meteor.isServer
342
- return [serverConfig];
345
+
346
+ return [config];
343
347
  }