-
Notifications
You must be signed in to change notification settings - Fork 11
/
craco.config.js
40 lines (37 loc) · 1.33 KB
/
craco.config.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
const { ESLINT_MODES } = require('@craco/craco');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (mode) => {
console.log('Environment:', mode.env);
const isProduction = mode.env === 'production';
const copyPatterns = [
{ from: './tcResources', to: 'static/tcResources' },
{ from: './src/tC_apps', to: 'static/tC_apps' },
{ from: './src/locale', to: 'static/locale' },
{ from: './src/assets/projectLicenses', to: 'static/projectLicenses' },
{ from: './src/assets/previewTemplate.css', to: 'static/assets/previewTemplate.css' },
{ from: './package.json', to: 'package.json' },
{ from: './electronite/cfg.json', to: 'cfg.json' },
{ from: './electronite/preloadSplash.js', to: 'preloadSplash.js' },
];
return {
webpack: {
configure: {
target: 'electron-renderer',
// eval-source-map allows to set inline breakpoints, and step debug at statement-level.
devtool: isProduction ? undefined : 'eval-source-map',
node: {
// TRICKY: don't let webpack hard-code these
__dirname: false,
__filename: false,
},
plugins: [
new CopyWebpackPlugin(copyPatterns),
],
resolve: {
mainFields: ['module', 'main'],
},
},
},
eslint: { mode: ESLINT_MODES.file },
};
};