[Vuejs]-`nuxt` vs `nuxt generate`: require is not defined

0๐Ÿ‘

Eh, this is a tumbleweed. I fixed it using isServer:


if (isServer) {
// https://github.com/nuxt/nuxt.js/issues/438
config.externals = [ nodeExternals({
whitelist: ['vue-videobg']
})]
}

0๐Ÿ‘

If you use Nuxt v.2.0, require is no more encouraged.
This what says the changelog of the 2.0 :
Upgrade nuxt.config.js, modules and serverMiddleware to use import/export instead of require

Leave a comment