Skip to content

Instantly share code, notes, and snippets.

@iDVB
Created November 11, 2015 17:03
Show Gist options
  • Save iDVB/602fdecf4529f08ae621 to your computer and use it in GitHub Desktop.
Save iDVB/602fdecf4529f08ae621 to your computer and use it in GitHub Desktop.
webpack -p breaking app
var host = 'localhost';
var port = parseInt(process.env.PORT) + 1 || 3001;
var path = require('path');
var bourbon = require('node-bourbon').includePaths;
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var Clean = require('clean-webpack-plugin');
var gitInfo = require('git-repo-info')();
var bower_dir = __dirname + '/bower_components';
var config = {
entry: path.resolve(__dirname, 'app/app.js'),
output: {
path: path.resolve(__dirname, 'build'),
filename: 'js/presentationbuilder.bundle.js',
//publicPath: 'http://' + host + ':' + port + '/public/'
},
resolve: {
alias: {
'env': path.join(__dirname, 'app/config/config-build.js')
}
},
plugins: [
new Clean(['build']),
new ExtractTextPlugin('css/presentationbuilder.bundle.css', {
allChunks: true
}),
new HtmlWebpackPlugin({
gitHash: gitInfo.abbreviatedSha,
filename: 'index.html',
template: path.resolve(__dirname, 'app/index.html'), // Load a custom template
inject: false // Do NOT inject any scripts into the html
})
],
module: {
noParse: [],
loaders: [
{ test: /\.(jsx|js)$/, exclude: /(node_modules|bower_components)/, loader: 'babel' }, // REACTJS FILES
{ test: /\.json?$/, exclude: /(node_modules|bower_components)/, loader: 'json' }, // JSON FILES
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('css!sass?includePaths[]=' + bourbon, { publicPath: '../'}) }, // SASS & CSS FILES
{ test: /\.(jpe?g|png|gif|svg)$/i, exclude: /(node_modules|bower_components)/, loader: 'url?limit=1000&name=res/img/[name].[ext]' } // IMAGES
]
},
progress: true
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment