@meteorjs/rspack 3.0.0-beta.1 → 3.0.0-beta.2
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/package.json +1 -1
- package/plugins/RequireExtenalsPlugin.js +7 -0
- package/rspack.config.js +39 -16
package/package.json
CHANGED
|
@@ -164,6 +164,13 @@ class RequireExternalsPlugin {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
compiler.hooks.done.tap({ name: this.pluginName, stage: -10 }, (stats) => {
|
|
167
|
+
// Preserve the last known-good Meteor runtime entry when compilation
|
|
168
|
+
// fails. Rewriting externals from incomplete stats would make Meteor
|
|
169
|
+
// restart against a broken Rspack bundle.
|
|
170
|
+
if (stats.hasErrors()) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
167
174
|
// 1) Ensure globalThis.module / exports block is present if enabled
|
|
168
175
|
if (this._enableGlobalPolyfill) {
|
|
169
176
|
this._ensureGlobalThisModule();
|
package/rspack.config.js
CHANGED
|
@@ -441,7 +441,7 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
441
441
|
],
|
|
442
442
|
};
|
|
443
443
|
|
|
444
|
-
if (Meteor.
|
|
444
|
+
if (Meteor.isVerbose) {
|
|
445
445
|
console.log("[i] Rspack mode:", mode);
|
|
446
446
|
console.log("[i] Meteor flags:", Meteor);
|
|
447
447
|
}
|
|
@@ -932,8 +932,8 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
932
932
|
|
|
933
933
|
delete config["meteor.enablePortableBuild"];
|
|
934
934
|
|
|
935
|
-
if (Meteor.
|
|
936
|
-
|
|
935
|
+
if (Meteor.isVerbose) {
|
|
936
|
+
console.log("Config:", inspect(config, { depth: null, colors: true }));
|
|
937
937
|
}
|
|
938
938
|
|
|
939
939
|
// Check if lazyCompilation is enabled and warn the user
|
|
@@ -950,19 +950,42 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
950
950
|
|
|
951
951
|
// Add MeteorRspackOutputPlugin as the last plugin to output compilation info
|
|
952
952
|
const meteorRspackOutputPlugin = new MeteorRspackOutputPlugin({
|
|
953
|
-
getData: (stats, { isRebuild, compilationCount, compiler }) =>
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
953
|
+
getData: (stats, { isRebuild, compilationCount, compiler }) => {
|
|
954
|
+
const generatedAppPaths = [
|
|
955
|
+
path.join('.meteor', 'local'),
|
|
956
|
+
path.join('.meteor', 'types'),
|
|
957
|
+
buildContext,
|
|
958
|
+
];
|
|
959
|
+
const changedFiles = [
|
|
960
|
+
...(compiler?.modifiedFiles || []),
|
|
961
|
+
...(compiler?.removedFiles || []),
|
|
962
|
+
];
|
|
963
|
+
const hasAppSourceChanges =
|
|
964
|
+
changedFiles.length === 0 ||
|
|
965
|
+
changedFiles.some(file => {
|
|
966
|
+
const relativePath = path.relative(projectDir, file);
|
|
967
|
+
return !generatedAppPaths.some(generatedPath =>
|
|
968
|
+
relativePath === generatedPath ||
|
|
969
|
+
relativePath.startsWith(`${generatedPath}${path.sep}`)
|
|
970
|
+
);
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
return {
|
|
974
|
+
name: config.name,
|
|
975
|
+
mode: config.mode,
|
|
976
|
+
hasErrors: stats.hasErrors(),
|
|
977
|
+
hasWarnings: stats.hasWarnings(),
|
|
978
|
+
hasAppSourceChanges,
|
|
979
|
+
hash: stats.hash,
|
|
980
|
+
timestamp: Date.now(),
|
|
981
|
+
statsOverrided,
|
|
982
|
+
compilationCount,
|
|
983
|
+
isRebuild,
|
|
984
|
+
...(!isRebuild && compiler && {
|
|
985
|
+
delegatedExtensions: extractDelegatedExtensions(stats, compiler),
|
|
986
|
+
}),
|
|
987
|
+
};
|
|
988
|
+
},
|
|
966
989
|
});
|
|
967
990
|
config.plugins = [meteorRspackOutputPlugin, ...(config.plugins || [])];
|
|
968
991
|
|