This repository has been archived by the owner on Sep 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
16,024 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
'use strict' | ||
'use strict'; | ||
|
||
process.env.BABEL_ENV = 'main' | ||
process.env.BABEL_ENV = 'main'; | ||
|
||
const path = require('path') | ||
const { dependencies } = require('../package.json') | ||
const webpack = require('webpack') | ||
const path = require('path'); | ||
const { dependencies } = require('../package.json'); | ||
const webpack = require('webpack'); | ||
|
||
const BabiliWebpackPlugin = require('babili-webpack-plugin') | ||
const BabiliWebpackPlugin = require('babili-webpack-plugin'); | ||
|
||
let mainConfig = { | ||
entry: { | ||
main: path.join(__dirname, '../src/main/index.js') | ||
}, | ||
externals: [ | ||
...Object.keys(dependencies || {}) | ||
], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js)$/, | ||
enforce: 'pre', | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'eslint-loader', | ||
options: { | ||
formatter: require('eslint-friendly-formatter') | ||
} | ||
} | ||
}, | ||
{ | ||
test: /\.js$/, | ||
use: 'babel-loader', | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /\.node$/, | ||
use: 'node-loader' | ||
} | ||
] | ||
}, | ||
node: { | ||
__dirname: process.env.NODE_ENV !== 'production', | ||
__filename: process.env.NODE_ENV !== 'production' | ||
}, | ||
output: { | ||
filename: '[name].js', | ||
libraryTarget: 'commonjs2', | ||
path: path.join(__dirname, '../dist/electron') | ||
}, | ||
plugins: [ | ||
new webpack.NoEmitOnErrorsPlugin() | ||
], | ||
resolve: { | ||
extensions: ['.js', '.json', '.node'] | ||
}, | ||
target: 'electron-main' | ||
} | ||
entry: { | ||
main: path.join(__dirname, '../src/main/index.js'), | ||
}, | ||
externals: [...Object.keys(dependencies || {})], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js)$/, | ||
enforce: 'pre', | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'eslint-loader', | ||
options: { | ||
formatter: require('eslint-friendly-formatter'), | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /\.js$/, | ||
use: 'babel-loader', | ||
exclude: /node_modules/, | ||
}, | ||
{ | ||
test: /\.node$/, | ||
use: 'node-loader', | ||
}, | ||
], | ||
}, | ||
node: { | ||
__dirname: process.env.NODE_ENV !== 'production', | ||
__filename: process.env.NODE_ENV !== 'production', | ||
}, | ||
output: { | ||
filename: '[name].js', | ||
libraryTarget: 'commonjs2', | ||
path: path.join(__dirname, '../dist/electron'), | ||
}, | ||
plugins: [new webpack.NoEmitOnErrorsPlugin()], | ||
resolve: { | ||
extensions: ['.js', '.json', '.node'], | ||
}, | ||
target: 'electron-main', | ||
}; | ||
|
||
/** | ||
* Adjust mainConfig for development settings | ||
*/ | ||
if (process.env.NODE_ENV !== 'production') { | ||
mainConfig.plugins.push( | ||
new webpack.DefinePlugin({ | ||
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"` | ||
}) | ||
) | ||
mainConfig.plugins.push( | ||
new webpack.DefinePlugin({ | ||
__static: `"${path | ||
.join(__dirname, '../static') | ||
.replace(/\\/g, '\\\\')}"`, | ||
}), | ||
); | ||
} | ||
|
||
/** | ||
* Adjust mainConfig for production settings | ||
*/ | ||
if (process.env.NODE_ENV === 'production') { | ||
mainConfig.plugins.push( | ||
new BabiliWebpackPlugin(), | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': '"production"' | ||
}) | ||
) | ||
mainConfig.plugins.push( | ||
new BabiliWebpackPlugin(), | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': '"production"', | ||
'process.env.APP_VERSION': `"${process.env.APP_VERSION}"`, | ||
'process.env.NET_ID': `"${process.env.NET_ID}"`, | ||
}), | ||
); | ||
} | ||
|
||
module.exports = mainConfig | ||
module.exports = mainConfig; |
Oops, something went wrong.