Reputation: 3857
When building an app in ssr mode I've noticed that vee-validate is not included in the build package and app crashes on the server.
To reproduce:
1) > nuxt build
2) delete vee-validate from local node_modules
3) > NODE_ENV=production node server/index.js
4) observe server error: Cannot find module 'vee-validate'
Versions:
nuxt v2.4.2
vee-validate v2.1.7
I have the following config:
nuxt.config.js:
plugins: [
{ src: '@/plugins/registerPlugins.js' }
],
registerPlugins.js:
import Vue from 'vue'
import VeeValidate from 'vee-validate'
Vue.use(VeeValidate, { inject: false })
I tried to configure nuxt.config so that 'vee-validate' would be force-packed but I haven't find a way.
I also tried to import vee-validate directly to a page component - same result.
Any ideas how to solve this problem?
Or at least how to tell webpack (via nuxt.config) to include vee-validate module?
Upvotes: 0
Views: 1257
Reputation: 17621
It's totally normal behaviour. None of third party node modules from package would be included into buuild, so you need to have them in your installation.
You can try to use standalone mode that will try to budnle all node modules into your build
https://github.com/nuxt/nuxt.js/pull/4661
Upvotes: 1