123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- const webpack = require('webpack');
- const path = require('path');
- const merge = require('webpack-merge');
- const autoprefixer = require('autoprefixer');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const OpenBrowserPlugin = require('open-browser-webpack-plugin');
- const baseWebpackConfig = require('./webpack.config.js');
- const config = require('./config.js');
- const hostPort = 8000;
- module.exports = merge(baseWebpackConfig, {
- entry: {
- main: [
-
- 'react-hot-loader/patch',
-
-
- 'webpack-dev-server/client?http://0.0.0.0:' + hostPort,
-
-
- 'webpack/hot/only-dev-server',
-
- path.resolve(__dirname, '../src/main.js')
- ],
- },
- output: {
- publicPath: config.prod.publicPath,
- path: config.prod.root,
- filename: path.posix.join(config.prod.subDirectory, 'js/[name].js'),
- chunkFilename: path.posix.join(config.prod.subDirectory, 'js/[name].chunk.js'),
- },
- mode: 'development',
- devtool: 'source-map',
- module: {
- rules: [{
- test: /\.(css|scss)$/,
- use: [
- 'style-loader',
- 'css-loader',
- {
- loader: 'postcss-loader',
- options: {
- plugins: function () {
- return [autoprefixer({ browsers: ["> 1%","last 2 versions","not ie <= 8"] })];
- }
- }
- },
- {
- loader: 'sass-loader',
- options: {
-
- }
- }
- ]
- }]
- },
- plugins: [
- new webpack.HotModuleReplacementPlugin(),
- new HtmlWebpackPlugin({
- template: path.resolve(__dirname, '../src/index.html'),
- filename: 'index.html',
- inject: true,
- }),
-
- new OpenBrowserPlugin({ url: 'http://localhost:' + hostPort })
- ],
- devServer: {
- historyApiFallback: true,
- contentBase: path.resolve(__dirname, '../src'),
- publicPath: '/',
- host: '0.0.0.0',
- port: hostPort,
- compress: true,
-
- hot: true,
- inline: true,
-
- stats: {
- colors: true
- },
-
- proxy: [
-
-
-
-
-
- {
- context: ["/api"],
- target: "http://127.0.0.1:3000",
- changeOrigin: true
- },
-
- ],
- after: function (app) {
- console.log('Listening at 0.0.0.0:' + hostPort + '...');
- }
- }
- });
|