Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Webpack] Compilation error fix #8293

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions npm-postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,19 @@ const getConfig = cp.spawn('php', [
'useEEGBrowserVisualizationComponents',
], {});

let EEGVisEnabled = false;
getConfig.stdout.on('data', (data) => {
const EEGVisEnabled = JSON.parse(data);
try {
EEGVisEnabled = JSON.parse(data);
} catch (e) {
console.warn(
'\x1b[33m',
'WARNING: Unable to fetch DB config',
'useEEGBrowserVisualizationComponents',
'\x1b[0m',
);
}

if (EEGVisEnabled === 'true') {
console.info('\n ----- \n >> '
+ 'EEG Browser visualization components enabled '
Expand All @@ -99,10 +110,12 @@ getConfig.stdout.on('data', (data) => {
);

protoc.on('error', (error) => {
console.error('ERROR: '
+ 'Make sure that protoc '
+ '(https://github.com/protocolbuffers/protobuf/releases/) '
+ 'is installed on your system '
console.error(
'\x1b[31m',
'ERROR: Make sure that protoc',
'(https://github.com/protocolbuffers/protobuf/releases/)',
'is installed on your system',
'\x1b[0m',
);
console.error(error);
});
Expand Down
11 changes: 10 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ if ('EEG_VIS_ENABLED' in process.env) {
'useEEGBrowserVisualizationComponents',
], {});

EEGVisEnabled = JSON.parse(getConfig.stdout);
try {
EEGVisEnabled = JSON.parse(getConfig.stdout);
} catch (e) {
console.warn(
'\x1b[33m',
'WARNING: Unable to fetch DB config',
'useEEGBrowserVisualizationComponents',
'\x1b[0m',
);
}
}

modulePlugins.push(
Expand Down