Skip to content

Commit

Permalink
[Webpack] Compilation error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
laemtl committed Dec 20, 2022
1 parent a286050 commit 645b5e3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
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

0 comments on commit 645b5e3

Please # to comment.