Skip to content

Commit

Permalink
add mac webpack file
Browse files Browse the repository at this point in the history
  • Loading branch information
xmeow committed Jan 6, 2017
1 parent 649ccea commit 44927d9
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions webpack.config.mac.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');

module.exports = {
entry: {
lib: ['react', 'react-dom'],
gui: './app/index.jsx'
},
output: {
path: path.resolve(__dirname, 'nwjs_mac/app'),
filename: '[name].js'
},
devServer: {
contentBase: path.resolve(__dirname, 'nwjs_mac/app'),
host: '0.0.0.0'
},
target: 'node-webkit',
module: {
externals: {
React: 'react',
ReactDOM: 'react-dom'
},
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
include: path.resolve(__dirname, 'app'),
query: {
plugins: ['transform-object-rest-spread'],
presets: ['es2015', 'react']
}
},
{
test: /\.svg$/,
loader: 'svg-url-loader?noquotes'
},
{
test : /\.(ttf|eot|png|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
loader : 'file-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
},{
test: /\.css$/, // Only .css files
loader: 'style!css' // Run both loaders
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env.BASE_PATH': '"' + (process.env.BASE_PATH || '/') + '"'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'lib',
filename: 'lib.min.js'
}),
new HtmlWebpackPlugin({
title: 'KittenBlock'
}),
new CopyWebpackPlugin([{
from: 'scratch-blocks/media',
to: 'media'
}])
].concat(process.env.NODE_ENV === 'production' ? [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
compress: {
warnings: false
}
})
] : [])
};

0 comments on commit 44927d9

Please sign in to comment.