insomnia/webpack/base.config.js

81 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-03-16 05:49:42 +00:00
var path = require('path');
var webpack = require('webpack');
2016-04-15 16:50:29 +00:00
var webpackTargetElectronRenderer = require('webpack-target-electron-renderer');
2016-03-16 05:49:42 +00:00
2016-04-15 16:50:29 +00:00
var config = {
2016-03-22 05:01:58 +00:00
target: 'web',
devtool: 'source-map',
2016-03-16 20:02:47 +00:00
context: path.join(__dirname, '../app'),
entry: [
'./index.js',
2016-03-22 18:20:05 +00:00
'./electron.html'
2016-03-16 20:02:47 +00:00
],
output: {
path: path.join(__dirname, '../dist'),
filename: 'bundle.js'
},
module: {
loaders: [
{
id: 'babel',
2016-04-16 23:24:57 +00:00
test: /\.(js|jsx)$/,
2016-04-03 22:54:39 +00:00
loaders: ['babel'],
2016-03-16 20:02:47 +00:00
exclude: /node_modules/
},
2016-04-16 23:24:57 +00:00
{
test: /\.json$/,
loader: 'json'
},
2016-03-16 20:02:47 +00:00
{
test: /\.(scss|css)$/,
loader: 'style!css!sass'
},
{
2016-04-16 23:24:57 +00:00
test: /\.html$/,
2016-03-16 20:02:47 +00:00
loader: "file?name=[name].[ext]"
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff"
},
{
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff"
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/octet-stream"
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file"
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=image/svg+xml"
}
]
},
resolve: {
2016-04-16 23:24:57 +00:00
extensions: ['', '.js', '.json', '.jsx'],
2016-03-22 18:20:05 +00:00
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main']
2016-04-15 16:50:29 +00:00
},
plugins: [
new webpack.DefinePlugin({
__DEV__: true,
'process.env': {
NODE_ENV: JSON.stringify('development')
}
}),
new webpack.ExternalsPlugin('commonjs', [
2016-04-16 23:24:57 +00:00
'request',
'nunjucks',
2016-04-18 04:39:15 +00:00
'pouchdb',
'pouchdb-find'
2016-04-15 16:50:29 +00:00
])
]
2016-03-16 20:02:47 +00:00
};
2016-04-15 16:50:29 +00:00
config.target = webpackTargetElectronRenderer(config);
module.exports = config;