Home

Issue: 1812

webpack externals settings can not work(Server side)

[issue link]

nuxt.config.js:

module.exports = {
  build: {
    vendor: [
      'element-ui', 'mint-ui', 'axios', 'moment', 'lodash'
    ],
    extend(config, ctx) {
      config.externals = config.externals || {}
      if (_.isPlainObject(config.externals)) {
        config.externals['jweixin'] = 'wx'
      } else if (_.isArray(config.externals)) {
        config.externals.push({
          jweixin: 'wx'
        })
      }
    }
  }
}
import wx from 'jweixin'

It report this:
Error: Cannot find module ‘wx’ from ‘/data/ydmap/node/ydmap-ssr-portal’

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