Skip to content

Instantly share code, notes, and snippets.

@nothingrealhappen
Last active December 4, 2015 07:06
Show Gist options
  • Save nothingrealhappen/0856d498e88038ebeb2e to your computer and use it in GitHub Desktop.
Save nothingrealhappen/0856d498e88038ebeb2e to your computer and use it in GitHub Desktop.
webpack config
const path = require('path');
const webpack = require('webpack'); const IS_PRODUCTION = process.env.NODE_ENV === 'production';
const OUT_DIR = path.join(__dirname, './bundle/');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
var config = {
context: __dirname,
entry: {
home: './src/home.js'
},
output: {
path: OUT_DIR,
filename: '[name].js',
publicPath: 'dist/'
},
resolve: {
root: [
path.join(__dirname, 'src/'),
path.join(__dirname, 'vendor/')
],
extensions: ['', '.js', '.jsx'],
alias: {}
},
module: {
noParse: [],
loaders: [
{ test: /\.js|\.jsx$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.json$/, loader: 'json-loader' }
]
},
plugins: [
new webpack.DefinePlugin({
IS_PRODUCTION: JSON.stringify(IS_PRODUCTION)
}),
new BrowserSyncPlugin(
{
host: 'localhost',
port: 9000,
// If you want use weinre for remote debug, change IP to your local ip
proxy: 'http://192.168.2.240:8080/',
files: [
'../app/assets/stylesheets/**/*.scss',
'../app/views/**/*.slim'
],
ui: {
port: 9001,
weinre: {
port: 9002
}
},
tunnel: true,
notify: false,
reloadOnRestart: true
}
)
],
externals: {
'jquery': 'jQuery'
},
devServer: {
proxy: {
'*': 'http://127.0.0.1:3000'
},
devtool: true,
colors: true,
progress: true,
host: '0.0.0.0'
}
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment