maxme-electron
Version:
The electron wrap of MaxME.
61 lines • 1.47 kB
JavaScript
const webpack = require('webpack');
const path = require('path');
const CSSExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = (env)=>{
const isProduction = env==='production';
console.log('env='+env);
return {
entry:'./src/app.js',
target: 'electron-renderer',
output:{
path:path.join(__dirname, 'pub','dist'),
filename:'bundle.js'
},
module:{
rules:[{
loader: 'babel-loader',
test: /\.js(x)?$/,
exclude: /node_modules/
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
},
{
test: /\.s?css$/,
use:[
{
loader:CSSExtractPlugin.loader
},
"css-loader",
"sass-loader"
]
},
{
test: /\.node$/,
use: 'node-loader'
}
]
},
plugins:[
new CSSExtractPlugin({
filename:`style.css`
}),
new HtmlWebPackPlugin({
template: path.resolve(__dirname, "./src/index.html"),
filename: path.resolve(__dirname, "./pub/index.html")
})
],
devtool: isProduction ? 'source-map':'inline-source-map',
devServer:{
contentBase: path.join(__dirname, 'pub'),
historyApiFallback:true,
publicPath:'/dist/'
}
};
}