2020-05-31 16:24:52 +08:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2020-07-19 14:55:39 +08:00
|
|
|
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
2020-05-31 16:24:52 +08:00
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
{
|
2020-06-15 14:16:49 +08:00
|
|
|
mode: 'production',
|
2020-05-31 16:24:52 +08:00
|
|
|
entry: './src/electron.ts',
|
|
|
|
target: 'electron-main',
|
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.ts$/,
|
|
|
|
include: /src/,
|
2020-06-15 17:25:55 +08:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js']
|
|
|
|
},
|
2020-05-31 16:24:52 +08:00
|
|
|
use: [{ loader: 'ts-loader' }]
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
output: {
|
2020-06-30 19:15:37 +08:00
|
|
|
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
|
2020-05-31 16:24:52 +08:00
|
|
|
path: __dirname + '/dist',
|
|
|
|
filename: 'electron.js'
|
2020-07-19 14:55:39 +08:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HardSourceWebpackPlugin()
|
|
|
|
]
|
2020-05-31 16:24:52 +08:00
|
|
|
},
|
2020-06-29 19:17:33 +08:00
|
|
|
{
|
|
|
|
mode: 'production',
|
|
|
|
entry: './src/preload.ts',
|
|
|
|
target: 'electron-preload',
|
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.ts$/,
|
|
|
|
include: /src/,
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js']
|
|
|
|
},
|
|
|
|
use: [{ loader: 'ts-loader' }]
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: __dirname + '/dist',
|
|
|
|
filename: 'preload.js'
|
2020-07-19 14:55:39 +08:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HardSourceWebpackPlugin()
|
|
|
|
]
|
2020-06-29 19:17:33 +08:00
|
|
|
},
|
2020-05-31 16:24:52 +08:00
|
|
|
{
|
2020-06-09 14:03:38 +08:00
|
|
|
mode: 'production',
|
2020-05-31 16:24:52 +08:00
|
|
|
entry: './src/index.tsx',
|
2020-06-30 19:15:37 +08:00
|
|
|
target: 'web',
|
2020-05-31 16:24:52 +08:00
|
|
|
devtool: 'source-map',
|
2020-06-30 19:15:37 +08:00
|
|
|
performance: {
|
|
|
|
hints: false
|
|
|
|
},
|
2020-05-31 16:24:52 +08:00
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.ts(x?)$/,
|
|
|
|
include: /src/,
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.tsx', '.js']
|
|
|
|
},
|
|
|
|
use: [{ loader: 'ts-loader' }]
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: __dirname + '/dist',
|
|
|
|
filename: 'index.js'
|
|
|
|
},
|
|
|
|
plugins: [
|
2020-07-19 14:55:39 +08:00
|
|
|
new HardSourceWebpackPlugin(),
|
2020-05-31 16:24:52 +08:00
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: './src/index.html'
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
];
|