Created
July 19, 2016 16:34
-
-
Save kswedberg/a8b776d1790de6d7c3df0364b3e69c60 to your computer and use it in GitHub Desktop.
This file contains 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 config = require('./webpack.config'); | |
var configs = [ | |
config({ | |
entry: { | |
head: ['app/assets/js/head.js')], | |
}, | |
outputFile: '[name].js', | |
chunkFile: '[name].js', | |
}), | |
config({ | |
entry: { | |
tail: [ | |
'babel-polyfill', | |
'app/assets/js/tail.js' | |
] | |
}, | |
outputFile: '[name].[hash].js', | |
chunkFile: '[name].[chunkhash].js', | |
}) | |
]; | |
configs.forEach(function(conf) { | |
webpack(conf, function(err, stats) { | |
// ... | |
}); | |
}); |
This file contains 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
module.exports = function(config) { | |
var loaders = [ | |
{ | |
loader: 'babel', | |
test: /\.jsx?$/, | |
include: [ | |
/app\/assets\/js/, | |
/fmjs/, | |
], | |
}, | |
// ... | |
]; | |
var webpackConfig = { | |
middlewarePublicPath: '/assets/js/', | |
entry: config.entry, | |
output: { | |
filename: config.outputFile, | |
chunkFilename: config.chunkFile, | |
path: 'public/assets/js', | |
}, | |
module: { | |
loaders: loaders, | |
}, | |
devServer: { | |
host: 'localhost', | |
port: 8080, | |
}, | |
// ... | |
}; | |
return webpackConfig; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment