Static GitHub Issues

[1812] webpack externals settings can not work(Server side)

prev: nuxt-start only works when `nuxt` installed
next: [question]Why does the vue plugin work when I connect to the layout and does not work when I connect to the page

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'

<!--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/c1627">#c1627</a>)</em></sub></div>