Home

Issue: 2031

webpackMiddleware configuration

[issue link]

How do I enable webpack middleware for Nuxt? During development, the build process is slow when writing files to disk, and I wish to use webpack middleware to generate build files in the memory.

Nuxt documentation states it is an Object. I have tried adding this to my nuxt.config.js, but it does not work.

webpackMiddleware: webpackMiddleware(webpack({
    entry: '...',
    output: {
      path: '/'
    }
  }), {
    noInfo: false,
    quiet: false,
    lazy: false,
    watchOptions: {
      aggregateTimeout: 300,
      poll: true
    },
    publicPath: ['/assets/', '/static/'],
    index: 'index.html',
    headers: { 'X-Custom-Header': 'yes' },
    stats: {
      colors: true
    },
    reporter: null,
    serverSideRender: false
  })

I would appreciate a working example.

This question is available on Nuxt.js community (#c1803)