react-easel
Version:
Widget to dynamically build forms using simple-schema and uniforms
97 lines (94 loc) • 2.85 kB
JavaScript
/**
* WEBPACK CONFIG
*
* Notes on config properties:
*
* 'entry'
* Entry point for the bundle.
*
* 'output'
* If you pass an array - the modules are loaded on startup. The last one is exported.
*
* 'resolve'
* Array of file extensions used to resolve modules.
*
* 'webpack-dev-server'
* Is a little node.js Express server, which uses the webpack-dev-middleware to
* serve a webpack bundle. It also has a little runtime which is connected to
* the server via Socket.IO.
*
* 'webpack/hot/dev-server'
* By adding a script to your index.html file and a special entry point in your
* configuration you will be able to get live reloads when doing changes to your
* files.
*
* devtool: 'eval-source-map'
* http://www.cnblogs.com/Answer1215/p/4312265.html
* The source map file will only be downloaded if you have source maps enabled
* and your dev tools open.
*
* HotModuleReplacementPlugin()
* Hot Module Replacement (HMR) exchanges, adds or removes modules while an
* application is running without page reload.
*
* NoErrorsPlugin()
* Hot loader is better when used with NoErrorsPlugin and hot/only-dev-server
* since it eliminates page reloads altogether and recovers after syntax errors.
*
* 'react-hot'
* React Hot Loader is a plugin for Webpack that allows instantaneous live
* refresh without losing state while editing React components.
*
* 'babel'
* Babel enables the use of ES6 today by transpiling your ES6 JavaScript into equivalent ES5 source
* that is actually delivered to the end user browser.
*/
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:5000',
'webpack/hot/dev-server',
'./src/index'
],
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js'
},
resolve: {
extensions: ['.js']
},
devtool: 'eval-source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel-loader'],
include: path.join(__dirname, 'src')
},
{
test: /\.css$/,
loader: 'style-loader!css-loader?sourceMap'
}, {
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/octet-stream"
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader"
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
}
]
}
};