Fix WASM QtLoader environment variable warning
There is a function throwIfEnvUsedButNotExported in qtloader.js that is intended to warn the user when they attempt to use environment variables without adding ENV to EXPORTED_RUNTIME_METHODS. (Presumably) through various changes this function no longer works. This change fixes it and adds to the warning to give Qt/CMake relevant advice. Pick-to: 6.7 Change-Id: Ia04c087d43bfe5ba988e0cf98230d796f1aaa069 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 8e04cb27357ab5dffa3d1fd00a416635c7881bc6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
3242676cd0
commit
94e8419ed5
@ -73,12 +73,15 @@ async function qtLoad(config)
|
||||
{
|
||||
const throwIfEnvUsedButNotExported = (instance, config) =>
|
||||
{
|
||||
const environment = config.environment;
|
||||
const environment = config.qt.environment;
|
||||
if (!environment || Object.keys(environment).length === 0)
|
||||
return;
|
||||
const isEnvExported = typeof instance.ENV === 'object';
|
||||
if (!isEnvExported)
|
||||
throw new Error('ENV must be exported if environment variables are passed');
|
||||
const descriptor = Object.getOwnPropertyDescriptor(instance, 'ENV');
|
||||
const isEnvExported = typeof descriptor.value === 'object';
|
||||
if (!isEnvExported) {
|
||||
throw new Error('ENV must be exported if environment variables are passed, ' +
|
||||
'add it to the QT_WASM_EXTRA_EXPORTED_METHODS CMake target property');
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof config !== 'object')
|
||||
|
Loading…
x
Reference in New Issue
Block a user