Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Wello/Wello/webpack.config.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
62 lines (55 sloc)
1.37 KB
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
const merge = require('webpack-merge'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const ENV = require('./env'); | |
const PATHS = { | |
src: path.join(__dirname, 'src'), | |
build: path.join(__dirname, 'www'), | |
}; | |
process.env.BABEL_ENV = ENV; | |
const common = { | |
entry: PATHS.src, | |
output: { | |
path: PATHS.build, | |
filename: 'bundle.js', | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.css$/, | |
loaders: ['style', 'css?url=false'], | |
include: PATHS.src, | |
}, | |
{ | |
test: /\.jsx?$/, | |
loader: 'babel?cacheDirectory', | |
include: PATHS.src, | |
} | |
] | |
} | |
}; | |
if (ENV === 'development') { | |
module.exports = merge(common, { | |
devServer: { | |
contentBase: PATHS.build, | |
// Enable history API fallback so HTML5 History API based | |
// routing works. This is a good default that will come | |
// in handy in more complicated setups. | |
historyApiFallback: true, | |
hot: true, | |
inline: true, | |
progress: true, | |
// Display only errors to reduce the amount of output. | |
stats: 'errors-only', | |
// Parse host and port from env so this is easy to customize. | |
host: process.env.HOST, | |
port: process.env.PORT, | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
], | |
}); | |
} else { | |
// config can be added here for minifying / etc | |
module.exports = merge(common, {}); | |
} |