2018-01-22 23:38:06 +00:00
|
|
|
'use strict';
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const path = require('path');
|
|
|
|
const ClearDistPlugin = require('./plugins/clearDist');
|
|
|
|
const config = require('./config');
|
|
|
|
|
|
|
|
const electronConfig = {
|
|
|
|
target: 'electron-main',
|
2018-04-05 20:53:36 +00:00
|
|
|
mode: 'development',
|
2018-01-22 23:38:06 +00:00
|
|
|
entry: {
|
2018-06-15 23:25:29 +00:00
|
|
|
main: path.join(config.path.electron, 'main/index.ts'),
|
|
|
|
preload: path.join(config.path.electron, 'preload/index.ts')
|
2018-01-22 23:38:06 +00:00
|
|
|
},
|
|
|
|
module: {
|
2018-06-25 19:27:27 +00:00
|
|
|
rules: [
|
|
|
|
config.typescriptRule,
|
|
|
|
// HTML as string
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
use: 'raw-loader',
|
|
|
|
}
|
|
|
|
]
|
2018-01-22 23:38:06 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-06-15 23:25:29 +00:00
|
|
|
extensions: ['.ts', '.js', '.json'],
|
|
|
|
modules: config.resolve.modules
|
2018-01-22 23:38:06 +00:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: '[name].js',
|
|
|
|
path: path.resolve(config.path.output, 'electron-js')
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new ClearDistPlugin(),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('development')
|
2018-06-18 01:53:00 +00:00
|
|
|
})
|
2018-01-22 23:38:06 +00:00
|
|
|
],
|
2018-06-15 23:25:29 +00:00
|
|
|
externals: {
|
|
|
|
'node-hid': 'commonjs node-hid'
|
|
|
|
},
|
2018-01-22 23:38:06 +00:00
|
|
|
node: {
|
|
|
|
__dirname: false,
|
|
|
|
__filename: false
|
2018-06-15 23:25:29 +00:00
|
|
|
},
|
|
|
|
devtool: 'eval'
|
2018-01-22 23:38:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = electronConfig;
|