This repository has been archived by the owner on Mar 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
66 lines (57 loc) · 1.81 KB
/
webpack.config.dev.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const merge = require('webpack-merge');
const package = require('./package.json');
const commonConfig = {
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
module: {
rules: [
{ test: /\.(png|jpe?g|gif)$/i, loader: 'file-loader' },
{ test: /\.(ts|js)x?$/, loader: 'babel-loader', include: /src/ },
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{ test: /\.py$/, use: 'raw-loader' }
],
},
plugins: [
new webpack.DefinePlugin({
'env_SFDC_CONSUMER_KEY': `"${process.env.SFDC_CONSUMER_KEY}"` || '',
'env_SFDC_CONSUMER_SECRET': `"${process.env.SFDC_CONSUMER_SECRET}"` || '',
'env_SFDC_USERNAME': `"${process.env.SFDC_USERNAME}"` || '',
'env_SFDC_PASSWORD': `"${process.env.SFDC_PASSWORD}"` || '',
'env_APP_VERSION': `"${package.version}"`
})
],
mode: "development",
watch: true,
devtool: "source-map"
}
const electronMainConfig = merge(commonConfig, {
entry: {
main: path.resolve(__dirname, 'src', 'main'),
},
target: 'electron-main',
node: {
__dirname: false
}
})
const electronRendererConfig = merge(commonConfig, {
entry: {
renderer: path.resolve(__dirname, 'src', 'renderer')
},
target: 'electron-renderer',
plugins: [
new HtmlWebpackPlugin({
title: 'Tabpy Tools',
template: './src/renderer/templates/index.html',
chunks: ['renderer']
}),
],
})
module.exports = [electronMainConfig, electronRendererConfig]