-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfig-overrides.js
40 lines (35 loc) · 1.1 KB
/
config-overrides.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const CopyWebPackPlugin = require('copy-webpack-plugin');
module.exports = function override(config) {
if (!config.plugins) {
config.plugins = [];
}
let pdfjsPath = 'node_modules/pdfjs-dist/build/';
if (process.env.USE_PDFJS_FROM_SOURCES === 'true') {
pdfjsPath = 'pdfjs/build/generic/build/';
}
config.plugins.push(
new CopyWebPackPlugin({
patterns: [
{
from: pdfjsPath + 'pdf.worker.js',
to: 'pdf.worker.js',
},
{
from: pdfjsPath + 'pdf.worker.js.map',
to: 'pdf.worker.js.map',
},
{
from: 'src/static/ABOUT.md',
to: 'ABOUT.md',
},
{
from: 'src/static/PRIVACY_POLICY.md',
to: 'PRIVACY_POLICY.md',
},
],
})
);
//workaround to avoid pdf.js critical dependency
config.module.parser = { javascript: { requireEnsure: true } };
return config;
};