[fix] 'process.env.NODE_ENV' check

Use babel to transpile the source code without bundling it.
Use webpack to create a standalone, productionized UMD bundle.

Fix #50
This commit is contained in:
Nicolas Gallagher
2015-12-26 14:22:36 +00:00
parent 5335bcfd48
commit 804132ce36
6 changed files with 68 additions and 84 deletions
+23 -9
View File
@@ -1,17 +1,31 @@
var assign = require('object-assign')
var base = require('./webpack.config.base')
var constants = require('./constants')
var path = require('path')
var webpack = require('webpack')
module.exports = assign({}, base, {
module.exports = {
devServer: {
contentBase: constants.EXAMPLES_DIRECTORY
},
entry: {
example: path.join(constants.EXAMPLES_DIRECTORY, 'index')
example: constants.EXAMPLES_DIRECTORY
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: { cacheDirectory: true }
}
]
},
output: {
filename: 'examples.js',
path: constants.DIST_DIRECTORY
}
})
filename: 'examples.js'
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin()
]
}