1
0
mirror of https://github.com/PanJiaChen/electron-vue-admin.git synced 2025-04-05 05:32:44 +08:00
electron-vue-admin/webpack.main.config.js
2017-07-14 16:08:15 +08:00

61 lines
1.2 KiB
JavaScript

'use strict'
process.env.BABEL_ENV = 'main'
const path = require('path')
const pkg = require('./app/package.json')
const webpack = require('webpack')
let mainConfig = {
entry: {
main: path.join(__dirname, 'app/src/main/index.js')
},
externals: Object.keys(pkg.dependencies || {}),
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.node$/,
loader: 'node-loader'
}
]
},
node: {
__dirname: false,
__filename: false
},
output: {
filename: '[name].js',
libraryTarget: 'commonjs2',
path: path.join(__dirname, 'app/dist')
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
],
resolve: {
extensions: ['.js', '.json', '.node'],
modules: [
path.join(__dirname, 'app/node_modules')
]
},
target: 'electron-main'
}
module.exports = mainConfig