mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
add legacy build configuration for SWC transpile and minification to fix issues on legacy bundles
This commit is contained in:
@@ -142,16 +142,6 @@ BCp.initializeMeteorAppSwcrc = function () {
|
||||
return lastModifiedSwcConfig;
|
||||
};
|
||||
|
||||
let lastModifiedSwcLegacyConfig;
|
||||
BCp.initializeMeteorAppLegacyConfig = function () {
|
||||
const swcLegacyConfig = convertBabelTargetsForSwc(Babel.getMinimumModernBrowserVersions());
|
||||
if (this.isVerbose() && !lastModifiedSwcLegacyConfig) {
|
||||
logConfigBlock('SWC Legacy Config', swcLegacyConfig);
|
||||
}
|
||||
lastModifiedSwcLegacyConfig = swcLegacyConfig;
|
||||
return lastModifiedSwcConfig;
|
||||
};
|
||||
|
||||
// Helper function to check if @swc/helpers is available
|
||||
function hasSwcHelpers() {
|
||||
return fs.existsSync(`${getMeteorAppDir()}/node_modules/@swc/helpers`);
|
||||
@@ -196,7 +186,6 @@ BCp.processFilesForTarget = function (inputFiles) {
|
||||
|
||||
this.initializeMeteorAppConfig();
|
||||
this.initializeMeteorAppSwcrc();
|
||||
this.initializeMeteorAppLegacyConfig();
|
||||
this.initializeMeteorAppSwcHelpersAvailable();
|
||||
|
||||
inputFiles.forEach(function (inputFile) {
|
||||
@@ -382,7 +371,18 @@ if (Plugin?.rspackHelpers?.isRspackOutputFile(inputFilePath)) {
|
||||
sourceFileName: filename,
|
||||
...(isLegacyWebArch && {
|
||||
env: {
|
||||
targets: lastModifiedSwcLegacyConfig || {},
|
||||
targets: {
|
||||
chrome: '49',
|
||||
edge: '15',
|
||||
firefox: '30',
|
||||
safari: '10',
|
||||
ios: '10',
|
||||
android: '5',
|
||||
opera: '42',
|
||||
ie: '11',
|
||||
node: '8',
|
||||
electron: '1.6',
|
||||
},
|
||||
mode: 'entry',
|
||||
coreJs: '3.37',
|
||||
},
|
||||
|
||||
@@ -49,6 +49,7 @@ export class MeteorMinifier {
|
||||
const NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
let content = file.getContentsAsString();
|
||||
const isLegacyBuild = file?._arch === 'web.browser.legacy';
|
||||
|
||||
return swc.minifySync(
|
||||
content,
|
||||
@@ -60,6 +61,7 @@ export class MeteorMinifier {
|
||||
unused: true,
|
||||
dead_code: true,
|
||||
typeofs: false,
|
||||
...(isLegacyBuild && { defaults: false }),
|
||||
|
||||
global_defs: {
|
||||
'process.env.NODE_ENV': NODE_ENV,
|
||||
|
||||
Reference in New Issue
Block a user