代码更改时,webpack不会重新加载

时间:2017-11-13 05:13:16

标签: javascript node.js reactjs webpack

有一个反应项目,一切都已配置,其他开发人员都工作正常,但我保存时没有自动页面更新。

webpack.config.js

var webpack = require('webpack');
module.exports = {
  entry: ['babel-polyfill', './src/index.js'],
  plugins: process.env.NODE_ENV === 'production' ? [
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin()
  ] : [],
  output: {
    path: './public/js',
    filename: 'bundle.js',
    publicPath: '/js'
  },
  watch: true,
  watchOptions: {
    aggregateTimeout: 100
  },
  module: {
    loaders: [{
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader?presets[]=es2015&presets[]=react'
      },
      {
        test: /\.css$/,
        loader: "style!css"
      }
    ]
  },
  devtool: "inline-source-map"
};

的package.json

"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build --env=production",
  "test_build": "react-scripts build --env=testing",
  "test": "react-scripts test --env=jsdom",
  "eject": "react-scripts eject"
}

我正在使用Ubuntu 16.04

tcp3000

0 个答案:

没有答案