Does not collect the project through webpack-dev-server



  • There's a webpack configuration:

    var webpack = require('webpack');
    var path    = require('path');
    

    module.exports = {
    entry : { app: [path.join(__dirname, '/src/index.js')] },
    output : {
    path : path.resolve(__dirname, 'public/'),
    filename : 'bundle.js'
    },
    devtool: 'source-map',

    module: {
    loaders: [
    {
    test : /.js$/,
    exclude : [/node_modules/, /public/],
    loader : 'babel',
    query : {
    presets: ['es2015']
    }
    },
    {
    test : /.css$/,
    loader : "style-loader!css-loader!autoprefixer-loader",
    exclude : [/node_modules/, /public/]
    },
    ]
    },

    devServer: {
    contentBase: 'public'
    },
    devServer: {
    proxy: {
    '': {
    target: 'http://127.0.0.1:3000/',
    secure: false
    }
    }
    },
    proxy: {
    '
    ': {
    target: 'http://127.0.0.1:3000/',
    secure: false
    }
    }
    }

    If I start a Webpack team, the project's going.

    If I start a webpack-dev-server team, what's the problem?



  • You seem to have two properties of devServer in the building.

    devServer: {
        contentBase: 'public'
    },
    devServer: {
        proxy: {
          '*': {
            target: 'http://127.0.0.1:3000/',
            secure: false
          }
        }
    },
    

    Unify them.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2