Created
May 5, 2015 17:23
-
-
Save JosephShering/402b12195847f813fd14 to your computer and use it in GitHub Desktop.
config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var nodeModules = {}; | |
fs.readdirSync('node_modules') | |
.filter(function(x) { | |
return ['.bin'].indexOf(x) === -1; | |
}) | |
.forEach(function(mod) { | |
nodeModules[mod] = 'commonjs ' + mod; | |
}); | |
server_config = { | |
entry: './src/server.js', | |
output: { | |
path: path.join(__dirname, 'build'), | |
publicPath: './', | |
filename: 'server.js' | |
}, | |
externals: nodeModules, | |
module: { | |
loaders: [{ | |
test: /\.jsx?$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/ | |
}] | |
}, | |
resolve: { | |
extensions: ['', '.js', '.jsx', '.json'] | |
}, | |
plugins: [ | |
new webpack.BannerPlugin('require("source-map-support").install();', { raw: true, entryOnly: false }), | |
new webpack.IgnorePlugin(/\.less$/) | |
], | |
devtool: 'source-map', | |
} | |
client_config = { | |
entry: './src/client.js', | |
output: { | |
path: path.join(__dirname, 'build', 'public'), | |
publicPath: './', | |
filename: 'client.js' | |
}, | |
module: { | |
loaders: [{ | |
test: /\.jsx?$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/ | |
}, { | |
test: /\.less$/, | |
loader: 'style-loader!css-loader!less-loader' | |
}], | |
}, | |
resolve: { | |
extensions: ['', '.js', '.jsx', '.json'] | |
} | |
} | |
module.exports = [server_config, client_config]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment