【问题标题】:Fuse-box watch and hot reload are not working保险丝盒手表和热重装不起作用
【发布时间】:2018-02-02 07:59:34
【问题描述】:

我正在将fuse-box 与 React web 项目一起使用,突然它正在观看并且热重载(hmr)不再工作了! 注意这一点:

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

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

这是保险丝盒的版本:

"fuse-box": "^2.2.2"

昨天很好用,不知道发生了什么变化,我卸载了watchman并重新安装了它,没有任何变化...... 注意我有 Ubuntu 16,这里是 fuse-box 文件”

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()

【问题讨论】:

    标签: linux reactjs watch build-system


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2011-06-11
      • 1970-01-01
      • 1970-01-01
      • 2019-08-25
      • 2015-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      相关资源
      最近更新 更多