保险丝盒手表和热重装不起作用

时间:2017-08-24 12:23:03

标签: linux reactjs watch build-system

我正在使用fuse-box与React网络项目,突然它正在观看,热重载(hmr)不再工作了! 注意这个:

---------------------------------------------------
Development server running http://localhost:10008
---------------------------------------------------

14:26:47: Client connected
14:26:48: HMR is enabled

这是fuse-box的版本:

"fuse-box": "^2.2.2"
昨天它工作得很好,我不知道改变了什么,我卸载了守望者并重新安装它,并没有改变...... 注意我有Ubuntu 16,这里是保险丝盒文件“

const {resolve} = require('path')

const {
  FuseBox,
  SVGPlugin,
  CSSPlugin,
  WebIndexPlugin,
  BabelPlugin,
  SassPlugin,
  JSONPlugin,
  CSSModules,
  EnvPlugin,
  UglifyJSPlugin,
  ImageBase64Plugin,
  CopyPlugin,
  CSSResourcePlugin,
  Sparky,
  LESSPlugin
} = require('fuse-box')

const res = rel => resolve(__dirname, rel)

let mode = 'development'
let port = '4444'

let args = process.argv.slice(2) || []

if (args.length) mode = args[0]
if (args.length > 1) port = parseInt(args[1])

let production = mode == 'production'
let development = mode == 'development'
let server = mode == 'production'

let fuse = new FuseBox({
  cache: development,
  // kcache: true,
  log: development,
  debug: development,
  homeDir: './',
  sourcemaps: development,
  output: 'output/$name.js',
  alias: {
    home: '~/src',
    components: '~/src/components',
    modules: '~/src/modules',
    landing: '~/src/modules/landing',
    auth: '~/src/modules/auth',
    content: '~/src/modules/landing/content',
    assets: '~/src/assets',
    styles: '~/src/styles',
    network: '~/src/network',
    observables: '~/src/observables',
    popups: '~/src/components/popups',
    listitems: '~/src/components/listitems',
    helpers: '~/src/helpers'
  },

  plugins: [
    EnvPlugin({NODE_ENV: 'development'}),
    JSONPlugin(),
    BabelPlugin({
      config: {
        sourceMaps: development,
        presets: ['react', 'es2015', 'stage-2'],
        plugins: [
          'transform-object-assign',
          'transform-decorators-legacy',
          'transform-class-properties'
        ]
      }
    }),
    WebIndexPlugin({
      title: 'My app',
      template: 'src/index.html'
    }),
    [
      SassPlugin({
        importer: true,
        macros: {$styles: 'src/styles'}
      }),
      // CSSResourcePlugin(),
      CSSPlugin()
      // {
      // group: 'app.css',
      // outFile: res('output/app.css')
      // }
    ],
    // [LESSPlugin(), CSSPlugin()],
    [CSSResourcePlugin(), CSSPlugin()],
    ImageBase64Plugin()
  ]
})

fuse.dev({port})
const app = fuse
  .bundle('app')
  .target('browser')
  .instructions(
    '> src/index.js +[node-modules/react-toolbox/**/*.sass] +[stylesheets/**/*.sass]'
  )
if (development)
  app.sourceMaps({project: true, vendor: false}).watch('src/**').hmr()
fuse.run()

1 个答案:

答案 0 :(得分:0)

确保您已启用缓存,因为如果它已关闭,它将无法正常工作。 删除.fuse-box并重新启动它。