2016-09-15 20:04:45 +02:00
|
|
|
/* global module, __dirname, require */
|
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const merge = require('webpack-merge');
|
2016-10-26 19:51:35 +02:00
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
|
2016-09-15 20:04:45 +02:00
|
|
|
const HOST = 'localhost';
|
|
|
|
const PORT = '8080';
|
|
|
|
|
|
|
|
module.exports = merge.smart(require('./webpack.base.js'), {
|
|
|
|
entry: {
|
|
|
|
cms: [
|
|
|
|
'webpack/hot/dev-server',
|
2016-10-26 19:51:35 +02:00
|
|
|
`webpack-dev-server/client?http://${ HOST }:${ PORT }/`,
|
2016-09-15 20:04:45 +02:00
|
|
|
'react-hot-loader/patch',
|
2016-10-26 19:51:35 +02:00
|
|
|
'./index',
|
2016-09-15 20:04:45 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
|
|
|
filename: '[name].js',
|
2016-10-26 19:51:35 +02:00
|
|
|
publicPath: `http://${ HOST }:${ PORT }/`,
|
2016-11-23 13:37:51 -08:00
|
|
|
library: 'netlify-cms',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
umdNamedDefine: true,
|
2016-09-15 20:04:45 +02:00
|
|
|
},
|
|
|
|
context: path.join(__dirname, 'src'),
|
2016-10-26 19:51:35 +02:00
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
loader: 'babel',
|
|
|
|
test: /\.js?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
query: {
|
|
|
|
plugins: [
|
|
|
|
'react-hot-loader/babel',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2016-09-15 20:04:45 +02:00
|
|
|
plugins: [
|
2016-10-26 19:51:35 +02:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: JSON.stringify('development'),
|
|
|
|
},
|
|
|
|
}),
|
2016-09-15 20:04:45 +02:00
|
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
new webpack.NoErrorsPlugin(),
|
2016-10-26 19:51:35 +02:00
|
|
|
new ExtractTextPlugin('[name].css', { disable: true }),
|
2016-09-15 20:04:45 +02:00
|
|
|
],
|
|
|
|
devServer: {
|
|
|
|
hot: true,
|
|
|
|
contentBase: 'example/',
|
|
|
|
historyApiFallback: true,
|
2016-10-26 19:51:35 +02:00
|
|
|
devTool: 'cheap-module-source-map',
|
2016-09-15 20:04:45 +02:00
|
|
|
},
|
|
|
|
});
|