2016-05-24 19:12:06 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const path = require('path')
|
2016-06-16 22:10:31 +00:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
2016-05-24 19:12:06 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: [
|
|
|
|
'./src/index'
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
filename: 'bundle.js',
|
|
|
|
path: path.join(__dirname, 'build'),
|
|
|
|
libraryTarget: 'commonjs2'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
loaders: ['babel', 'ts'],
|
|
|
|
include: path.join(__dirname, 'src')
|
2016-06-16 17:23:52 +00:00
|
|
|
},
|
2016-06-16 23:37:57 +00:00
|
|
|
{
|
|
|
|
test: /\.(jpe?g|png|gif|ico)$/,
|
|
|
|
loaders: ["file?name=[path][name].[ext]"]
|
2016-05-24 19:12:06 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['', '.js', '.ts', '.tsx'],
|
|
|
|
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main']
|
|
|
|
},
|
|
|
|
target: 'electron',
|
2016-06-16 22:10:31 +00:00
|
|
|
plugins: [new HtmlWebpackPlugin({ 'template': 'static/index.html' })],
|
2016-05-24 19:12:06 +00:00
|
|
|
externals: function (context, request, callback) {
|
|
|
|
try {
|
|
|
|
// Attempt to resolve the module via Node
|
|
|
|
require.resolve(request)
|
|
|
|
callback(null, request)
|
|
|
|
} catch (e) {
|
|
|
|
// Node couldn't find it, so it must be user-aliased
|
|
|
|
callback()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|