Static GitHub Issues

[348] Exclude files from webpack bundle (server only javascript)

prev: webpack proxy not work
next: Error - google-analytics - The client-side rendered virtual DOM tree is not matching..

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:

<img width="901" alt="screen shot 2017-03-05 at 3 41 55 pm" src="https://cloud.githubusercontent.com/assets/659829/23592741/540ce1a0-01ba-11e7-8cb4-1630baa68b33.png"><!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c297">#c297</a>)</em></sub></div>