Home

Issue: 348

Exclude files from webpack bundle (server only javascript)

[issue link]

I am using xmldom to shim the document on the server-side. However, I don’t need xmldom on the client and would like to exclude it from the webpack bundle.

Here’s what I have so far in my nuxt.config.js:

  build: {
    extend (config, { isDev, isClient }) {
      if (!config.externals) return
      config.externals = config.externals.filter(p => p !== 'xmldom')
    }
  },

This results in non-optimal bundles sizes:

screen shot 2017-03-05 at 3 41 55 pm
This question is available on Nuxt.js community (#c297)