@meteorjs/rspack 0.1.6 → 0.2.50
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 +6 -1
- package/package.json +1 -1
- package/plugins/RequireExtenalsPlugin.js +11 -6
- package/rspack.config.js +3 -2
package/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ type MeteorEnv = Record<string, any> & {
|
|
|
43
43
|
* @param options - Optional configuration options
|
|
44
44
|
* @returns A config object with module rules configuration
|
|
45
45
|
*/
|
|
46
|
-
compileWithRspack: (deps: RuleSetConditions) => Record<string, object>;
|
|
46
|
+
compileWithRspack: (deps: RuleSetConditions, options?: SwcLoaderOptions) => Record<string, object>;
|
|
47
47
|
/**
|
|
48
48
|
* Enable or disable Rspack cache config.
|
|
49
49
|
* @param enabled - Whether to enable caching
|
|
@@ -61,6 +61,11 @@ type MeteorEnv = Record<string, any> & {
|
|
|
61
61
|
* @returns A config object with SWC loader config
|
|
62
62
|
*/
|
|
63
63
|
extendSwcConfig: (swcConfig: SwcLoaderOptions) => Record<string, object>;
|
|
64
|
+
/**
|
|
65
|
+
* Extend Rspack configs.
|
|
66
|
+
* @returns A config object with merged configs
|
|
67
|
+
*/
|
|
68
|
+
extendConfig: (...configs: Record<string, object>[]) => Record<string, object>;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
export type ConfigFactory = (
|
package/package.json
CHANGED
|
@@ -443,13 +443,18 @@ class RequireExternalsPlugin {
|
|
|
443
443
|
|
|
444
444
|
_ensureGlobalThisModule() {
|
|
445
445
|
const block = [
|
|
446
|
-
`/* Polyfill globalThis.module &
|
|
447
|
-
`if (typeof globalThis
|
|
448
|
-
` globalThis.module
|
|
446
|
+
`/* Polyfill globalThis.module, exports & module for legacy */`,
|
|
447
|
+
`if (typeof globalThis !== 'undefined') {`,
|
|
448
|
+
` if (typeof globalThis.module === 'undefined') {`,
|
|
449
|
+
` globalThis.module = { exports: {} };`,
|
|
450
|
+
` }`,
|
|
451
|
+
` if (typeof globalThis.exports === 'undefined') {`,
|
|
452
|
+
` globalThis.exports = globalThis.module.exports;`,
|
|
453
|
+
` }`,
|
|
454
|
+
`}`,
|
|
455
|
+
`if (typeof window.module === 'undefined') {`,
|
|
456
|
+
` window.module = { exports: {} };`,
|
|
449
457
|
`}`,
|
|
450
|
-
`if (typeof globalThis.exports === 'undefined') {`,
|
|
451
|
-
` globalThis.exports = globalThis.module.exports;`,
|
|
452
|
-
`}`
|
|
453
458
|
].join('\n') + '\n';
|
|
454
459
|
|
|
455
460
|
let content = '';
|
package/rspack.config.js
CHANGED
|
@@ -274,9 +274,9 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
274
274
|
|
|
275
275
|
// Expose Meteor's helpers to expand Rspack configs
|
|
276
276
|
Meteor.compileWithMeteor = deps => compileWithMeteor(deps);
|
|
277
|
-
Meteor.compileWithRspack = deps =>
|
|
277
|
+
Meteor.compileWithRspack = (deps, options = {}) =>
|
|
278
278
|
compileWithRspack(deps, {
|
|
279
|
-
options: Meteor.swcConfigOptions,
|
|
279
|
+
options: mergeSplitOverlap(Meteor.swcConfigOptions, options),
|
|
280
280
|
});
|
|
281
281
|
Meteor.setCache = enabled =>
|
|
282
282
|
setCache(
|
|
@@ -285,6 +285,7 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
285
285
|
);
|
|
286
286
|
Meteor.splitVendorChunk = () => splitVendorChunk();
|
|
287
287
|
Meteor.extendSwcConfig = (customSwcConfig) => extendSwcConfig(customSwcConfig);
|
|
288
|
+
Meteor.extendConfig = (...configs) => mergeSplitOverlap(...configs);
|
|
288
289
|
|
|
289
290
|
// Add HtmlRspackPlugin function to Meteor
|
|
290
291
|
Meteor.HtmlRspackPlugin = (options = {}) => {
|