const webpack = require('webpack'); const merge = require('webpack-merge'); const path = require('path'); const base = require('./webpack.base.config'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require("extract-text-webpack-plugin"); let output = { path : path.resolve(__dirname, 'dist'), publicPath : '/', filename : '[name].bundle.js', chunkFilename : '[name].chunk.js' } // config.devtool = '#source-map'; // config.devServer = { // disableHostCheck: true // } // config.output.publicPath = '/'; // config.output.filename = '[name].js'; // config.output.chunkFilename = '[name].chunk.js'; // config.plugins = (config.plugins || []).concat([ // new ExtractTextPlugin("[name].css",{ allChunks : false, resolve : ['modules'] }), // new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), // new HtmlWebpackPlugin({ // filename: '../index.html', // template: './index.ejs', // inject: false // }), // new webpack.ProvidePlugin({ // $: "jquery", // jQuery: "jquery", // "window.jQuery": "jquery" // }) // ]); // config.devServer = { // contentBase: './dist', // host: '0.0.0.0', // port: 1024, // hot: true, // inline: true, // // useLocalIp: true, // compress: true, // disableHostCheck: true, // historyApiFallback: true // } let plugins = [ new ExtractTextPlugin("[name].css", { allChunks : true, resolve : ['modules'] }), new webpack.optimize.CommonsChunkPlugin({ name :'vendors', filename: 'vendors.js' }), new HtmlWebpackPlugin({ filename: 'index.html', template: './index.ejs', inject: 'body', // chunks: ['main','vendors'] }), new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery" }) ] let devServer = { contentBase: './dist', host: '0.0.0.0', port: 1024, hot: true, inline: true, // useLocalIp: true, disableHostCheck: true, historyApiFallback: true } module.exports = merge(base, { output: output, plugins: plugins, // devtool: 'eval-source-map', devServer: devServer });