Skip to content

Commit 59524cb

Browse files
committed
[Webpack] Compilation error fix
1 parent a286050 commit 59524cb

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

npm-postinstall.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,19 @@ const getConfig = cp.spawn('php', [
7575
'useEEGBrowserVisualizationComponents',
7676
], {});
7777

78+
let EEGVisEnabled = false;
7879
getConfig.stdout.on('data', (data) => {
79-
const EEGVisEnabled = JSON.parse(data);
80+
try {
81+
EEGVisEnabled = JSON.parse(data);
82+
} catch (e) {
83+
console.warn(
84+
'\x1b[33m',
85+
'WARNING: Unable to fetch DB config',
86+
'useEEGBrowserVisualizationComponents',
87+
'\x1b[0m',
88+
);
89+
}
90+
8091
if (EEGVisEnabled === 'true') {
8192
console.info('\n ----- \n >> '
8293
+ 'EEG Browser visualization components enabled '
@@ -99,10 +110,12 @@ getConfig.stdout.on('data', (data) => {
99110
);
100111

101112
protoc.on('error', (error) => {
102-
console.error('ERROR: '
103-
+ 'Make sure that protoc '
104-
+ '(https://github.com/protocolbuffers/protobuf/releases/) '
105-
+ 'is installed on your system '
113+
console.error(
114+
'\x1b[31m',
115+
'ERROR: Make sure that protoc',
116+
'(https://github.com/protocolbuffers/protobuf/releases/)',
117+
'is installed on your system',
118+
'\x1b[0m',
106119
);
107120
console.error(error);
108121
});

webpack.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,16 @@ if ('EEG_VIS_ENABLED' in process.env) {
7676
'useEEGBrowserVisualizationComponents',
7777
], {});
7878

79-
EEGVisEnabled = JSON.parse(getConfig.stdout);
79+
try {
80+
EEGVisEnabled = JSON.parse(getConfig.stdout);
81+
} catch (e) {
82+
console.warn(
83+
'\x1b[33m',
84+
'WARNING: Unable to fetch DB config',
85+
'useEEGBrowserVisualizationComponents',
86+
'\x1b[0m',
87+
);
88+
}
8089
}
8190

8291
modulePlugins.push(

0 commit comments

Comments
 (0)