-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.main.config.js
39 lines (38 loc) · 1.06 KB
/
webpack.main.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 CopyPlugin = require("copy-webpack-plugin");
const ReplaceInFileWebpackPlugin = require('replace-in-file-webpack-plugin');
const path = require("path");
module.exports = {
/**
* This is the main entry point for your application, it's the first file
* that runs in the main process.
*/
entry: './src/index.ts',
// Put your normal webpack config below here
module: {
rules: require('./webpack.rules'),
},
stats: 'none',
plugins: [
new CopyPlugin({
patterns: [{
from: "src/main/config/*.json",
to: "config/[name][ext]"
}
],
}),
new ReplaceInFileWebpackPlugin([{
dir: path.resolve(__dirname, '.webpack', 'main', 'config'),
files: ['default.json'],
rules: [{
search: '{{GOOGLE_API_CSE}}',
replace: process.env.GOOGLE_API_CSE || 'KEY_NOT_DEFINED'
},{
search: '{{GOOGLE_API_KEY}}',
replace: process.env.GOOGLE_API_KEY || 'KEY_NOT_DEFINED'
}]
}])
],
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'],
},
};