@meteorjs/rspack 0.0.21 → 0.0.23

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.
package/index.d.ts CHANGED
@@ -25,6 +25,12 @@ type MeteorEnv = Record<string, any> & {
25
25
  isReactEnabled: boolean;
26
26
  isBlazeEnabled: boolean;
27
27
  isBlazeHotEnabled: boolean;
28
+ /**
29
+ * A function that creates an instance of HtmlRspackPlugin with default options.
30
+ * @param options - Optional configuration options that will be merged with defaults
31
+ * @returns An instance of HtmlRspackPlugin
32
+ */
33
+ HtmlRspackPlugin: (options?: HtmlRspackPluginOptions) => HtmlRspackPlugin;
28
34
  }
29
35
 
30
36
  export type ConfigFactory = (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteorjs/rspack",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
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
@@ -161,6 +161,28 @@ export default function (inMeteor = {}, argv = {}) {
161
161
  const buildOutputDir = path.resolve(process.cwd(), buildContext, outputDir);
162
162
  Meteor.buildOutputDir = buildOutputDir;
163
163
 
164
+ // Add HtmlRspackPlugin function to Meteor
165
+ Meteor.HtmlRspackPlugin = (options = {}) => {
166
+ return new HtmlRspackPlugin({
167
+ inject: false,
168
+ cache: true,
169
+ filename: `../${buildContext}/${outputDir}/index.html`,
170
+ templateContent: `
171
+ <head>
172
+ <% for tag in htmlRspackPlugin.tags.headTags { %>
173
+ <%= toHtml(tag) %>
174
+ <% } %>
175
+ </head>
176
+ <body>
177
+ <% for tag in htmlRspackPlugin.tags.bodyTags { %>
178
+ <%= toHtml(tag) %>
179
+ <% } %>
180
+ </body>
181
+ `,
182
+ ...options
183
+ });
184
+ };
185
+
164
186
  // Set watch options
165
187
  const watchOptions = {
166
188
  ...defaultWatchOptions,
@@ -291,23 +313,7 @@ export default function (inMeteor = {}, argv = {}) {
291
313
  banner: bannerOutput,
292
314
  entryOnly: true,
293
315
  }),
294
- new HtmlRspackPlugin({
295
- inject: false,
296
- cache: true,
297
- filename: `../${buildContext}/${outputDir}/index.html`,
298
- templateContent: `
299
- <head>
300
- <% for tag in htmlRspackPlugin.tags.headTags { %>
301
- <%= toHtml(tag) %>
302
- <% } %>
303
- </head>
304
- <body>
305
- <% for tag in htmlRspackPlugin.tags.bodyTags { %>
306
- <%= toHtml(tag) %>
307
- <% } %>
308
- </body>
309
- `,
310
- }),
316
+ // Meteor.HtmlRspackPlugin(),
311
317
  ],
312
318
  watchOptions,
313
319
  devtool: isDevEnvironment || isTest ? 'source-map' : 'hidden-source-map',
@@ -368,8 +374,8 @@ export default function (inMeteor = {}, argv = {}) {
368
374
  "Meteor.isDevelopment": JSON.stringify(isDev),
369
375
  }
370
376
  : {
371
- "Meteor.isClient": JSON.stringify(true),
372
- "Meteor.isServer": JSON.stringify(false),
377
+ "Meteor.isClient": JSON.stringify(false),
378
+ "Meteor.isServer": JSON.stringify(true),
373
379
  "Meteor.isTest": JSON.stringify(isTest),
374
380
  "Meteor.isDevelopment": JSON.stringify(isDev),
375
381
  "Meteor.isProduction": JSON.stringify(isProd),