mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Don't include document in scuttling config for mv3 builds (#18356)
* Don't include document in scuttling config for mv3 builds * Fix env var comparison * lint fix
This commit is contained in:
parent
2029fb28ff
commit
7a8d0273a0
@ -20,6 +20,7 @@ const configurationPropertyNames = [
|
|||||||
'DISABLE_WEB_SOCKET_ENCRYPTION',
|
'DISABLE_WEB_SOCKET_ENCRYPTION',
|
||||||
'METAMASK_DEBUG',
|
'METAMASK_DEBUG',
|
||||||
'SKIP_OTP_PAIRING_FLOW',
|
'SKIP_OTP_PAIRING_FLOW',
|
||||||
|
'ENABLE_MV3',
|
||||||
];
|
];
|
||||||
|
|
||||||
const productionConfigurationPropertyNames = [
|
const productionConfigurationPropertyNames = [
|
||||||
|
@ -52,7 +52,7 @@ const {
|
|||||||
} = require('./transforms/remove-fenced-code');
|
} = require('./transforms/remove-fenced-code');
|
||||||
|
|
||||||
// map dist files to bag of needed native APIs against LM scuttling
|
// map dist files to bag of needed native APIs against LM scuttling
|
||||||
const scuttlingConfig = {
|
const scuttlingConfigBase = {
|
||||||
'sentry-install.js': {
|
'sentry-install.js': {
|
||||||
// globals sentry need to function
|
// globals sentry need to function
|
||||||
window: '',
|
window: '',
|
||||||
@ -70,7 +70,6 @@ const scuttlingConfig = {
|
|||||||
Number: '',
|
Number: '',
|
||||||
Request: '',
|
Request: '',
|
||||||
Date: '',
|
Date: '',
|
||||||
document: '',
|
|
||||||
JSON: '',
|
JSON: '',
|
||||||
encodeURIComponent: '',
|
encodeURIComponent: '',
|
||||||
crypto: '',
|
crypto: '',
|
||||||
@ -87,6 +86,16 @@ const scuttlingConfig = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mv3ScuttlingConfig = { ...scuttlingConfigBase };
|
||||||
|
|
||||||
|
const standardScuttlingConfig = {
|
||||||
|
...scuttlingConfigBase,
|
||||||
|
'sentry-install.js': {
|
||||||
|
...scuttlingConfigBase['sentry-install.js'],
|
||||||
|
document: '',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the appropriate Infura project ID.
|
* Get the appropriate Infura project ID.
|
||||||
*
|
*
|
||||||
@ -932,9 +941,8 @@ function setupBundlerDefaults(
|
|||||||
|
|
||||||
// Setup source maps
|
// Setup source maps
|
||||||
setupSourcemaps(buildConfiguration, { buildTarget });
|
setupSourcemaps(buildConfiguration, { buildTarget });
|
||||||
|
|
||||||
// Setup wrapping of code against scuttling (before sourcemaps generation)
|
// Setup wrapping of code against scuttling (before sourcemaps generation)
|
||||||
setupScuttlingWrapping(buildConfiguration, applyLavaMoat);
|
setupScuttlingWrapping(buildConfiguration, applyLavaMoat, envVars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -988,7 +996,11 @@ function setupMinification(buildConfiguration) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupScuttlingWrapping(buildConfiguration, applyLavaMoat) {
|
function setupScuttlingWrapping(buildConfiguration, applyLavaMoat, envVars) {
|
||||||
|
const scuttlingConfig =
|
||||||
|
envVars.ENABLE_MV3 === 'true'
|
||||||
|
? mv3ScuttlingConfig
|
||||||
|
: standardScuttlingConfig;
|
||||||
const { events } = buildConfiguration;
|
const { events } = buildConfiguration;
|
||||||
events.on('configurePipeline', ({ pipeline }) => {
|
events.on('configurePipeline', ({ pipeline }) => {
|
||||||
pipeline.get('scuttle').push(
|
pipeline.get('scuttle').push(
|
||||||
@ -1111,6 +1123,7 @@ async function getEnvironmentVariables({ buildTarget, buildType, version }) {
|
|||||||
ICON_NAMES: iconNames,
|
ICON_NAMES: iconNames,
|
||||||
MULTICHAIN: config.MULTICHAIN === '1',
|
MULTICHAIN: config.MULTICHAIN === '1',
|
||||||
CONF: devMode ? config : {},
|
CONF: devMode ? config : {},
|
||||||
|
ENABLE_MV3: config.ENABLE_MV3,
|
||||||
IN_TEST: testing,
|
IN_TEST: testing,
|
||||||
INFURA_PROJECT_ID: getInfuraProjectId({
|
INFURA_PROJECT_ID: getInfuraProjectId({
|
||||||
buildType,
|
buildType,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user