Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Last active March 5, 2016 01:02
Show Gist options
  • Save ryanflorence/23f01a0511cce34f7881 to your computer and use it in GitHub Desktop.
Save ryanflorence/23f01a0511cce34f7881 to your computer and use it in GitHub Desktop.
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var shared = require('./shared')
module.exports = {
devtool: 'inline-source-map',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
shared.appEntry,
],
output: {
filename: 'app.js',
path: shared.buildDirectory,
publicPath: '/assets/',
},
plugins: shared.plugins.concat([
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin('style.less', {
allChunks: true,
}),
]),
resolve: shared.resolve,
module: {
loaders: shared.loaders.concat([
{ test: /\.js$/,
loaders: [ 'react-hot', 'babel' ],
exclude: /node_modules/,
},
{ test: /\.less$/,
loader: 'style!css?sourceMap!less?sourceMap',
},
{ test: /\.css/,
loader: 'style!css?sourceMap',
},
]),
},
}
module.exports = process.env.NODE_ENV === 'production' ?
require('./config.production'):
require('./config.development')
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var shared = require('./shared')
module.exports = {
devtool: 'source-map',
entry: {
app: shared.appEntry,
vendor: [ 'react', 'react-router' ],
},
output: {
filename: '[name].js',
path: shared.buildDirectory,
publicPath: '/',
},
plugins: shared.plugins.concat([
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compressor: { warnings: false },
}),
new ExtractTextPlugin('app.css', {
allChunks: true,
}),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
]),
resolve: shared.resolve,
module: {
loaders: shared.loaders.concat([
{ test: /\.js$/,
loaders: [ 'babel' ],
exclude: /node_modules/,
},
{ test: /\.less$/,
loader: 'style!css!less',
},
{ test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!cssnext-loader'),
},
{ test: /\.png$/,
loader: 'url-loader?mimetype=image/png',
},
]),
},
}
require('dotenv').load()
var path = require('path')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var root = path.join(__dirname, '..', '..')
exports.buildDirectory = path.join(root, '.build')
exports.appEntry = path.join(root, 'modules', 'ui', 'index.js')
exports.plugins = [
new HtmlWebpackPlugin({
title: 'Hum',
filename: 'index.html',
template: path.join(root, 'modules', 'server', 'index.template.html'),
//favicon: path.join(__dirname, 'src', 'shared', 'favicon.ico')
}),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'__DEBUGPANEL__': JSON.stringify(process.env.DEBUGPANEL),
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'FIREBASE_URL': JSON.stringify(process.env.FIREBASE_URL),
},
}),
]
exports.resolve = {
extensions: [ '', '.js', '.less' ],
modulesDirectories: [ 'modules', 'node_modules' ],
alias: {
firebase: 'firebase/lib/firebase-web',
},
}
exports.loaders = [
{ test: 'firebase/lib/firebase-web',
loader: 'imports?navigator=>window.navigator',
},
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff',
},
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
},
{ test: /\.(png|gif)$/,
loader: 'url-loader?limit=8000',
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment