/* eslint no-var: 0 */
var path = require('path');
var webpack = require('webpack');
var nib = require('nib');
var stylusLoader = require('stylus-loader');

module.exports = {
    devtool: 'source-map',
    entry: {
        navbar: path.resolve(__dirname, 'navbar.js'),
        examples: path.resolve(__dirname, 'examples.js')
    },
    output: {
        path: path.join(__dirname, '../docs'),
        filename: '[name].js'
    },
    module: {
        rules: [
            {
                test: /\.json$/,
                loader: 'json-loader'
            },
            {
                test: /\.jsx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.styl$/,
                loader: 'style-loader!css-loader!stylus-loader'
            },
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader'
            },
            {
                test: /\.(png|jpg)$/,
                loader: 'url-loader',
                query: {
                    limit: 8192
                }
            },
            {
                test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                loader: 'url-loader',
                query: {
                    limit: 10000,
                    mimetype: 'application/font-woff'
                }
            },
            {
                test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                loader: 'file-loader'
            }
        ]
    },
    plugins: [
        new webpack.LoaderOptionsPlugin({
            debug: true
        }),
        new stylusLoader.OptionsPlugin({
            default: {
                // nib - CSS3 extensions for Stylus
                use: [nib()],
                // no need to have a '@import "nib"' in the stylesheet
                import: ['~nib/lib/nib/index.styl']
            }
        }),
        new webpack.optimize.CommonsChunkPlugin('../docs/common'),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false
            },
            mangle: false
        })
    ],
    // https://webpack.github.io/docs/webpack-dev-server.html#additional-configuration-options
    devServer: {
        noInfo: false,
        lazy: false,
        // https://webpack.github.io/docs/node.js-api.html#compiler
        watchOptions: {
            poll: true // use polling instead of native watchers
        }
    }
};

@@ -154,53 +154,31 @@
 );%0A%0A
-module.exports = %7B%0A    devtool: 'source-map',
+const webpackConfig = %7B
 %0A   
@@ -1962,164 +1962,9 @@
 on')
-,%0A        new webpack.optimize.UglifyJsPlugin(%7B%0A            compress: %7B%0A                warnings: false%0A            %7D,%0A            mangle: false%0A        %7D)
 %0A
+
     
@@ -2074,24 +2074,56 @@
 evServer: %7B%0A
+        disableHostCheck: true,%0A
         noIn
@@ -2331,7 +2331,369 @@
   %7D%0A
-
 %7D;%0A
+%0Aif (process.env.NODE_ENV === 'development') %7B%0A    webpackConfig.devtool = 'eval';%0A%7D else %7B%0A    webpackConfig.devtool = 'source-map';%0A    webpackConfig.plugins.push(%0A        new webpack.optimize.UglifyJsPlugin(%7B%0A            compress: %7B%0A                warnings: false%0A            %7D,%0A            mangle: false%0A        %7D)%0A    );%0A%7D%0A%0Amodule.exports = webpackConfig;%0A

Update webpack.config.js