Static GitHub Issues

[1338] cannot find module in nuxt.config

prev: Custom URL for i18n
next: incorrect header check

Hi, I'm trying to require in a local json file sitting in my assets directory in order to nuxt-generate some routes. While requiring this file seems to work in pages, layouts, middleware, and stores, I cannot seem to get this to work in the nuxt config file. In dev, everything is fine, but once I run nuxt-generate, I run into some problems. In nuxt config, I see that

const axios = require('axios'); works fine, but

const contentfulData = require('~/assets/data/contentful-export.json'); does not.

Is this expected? Are there better ways to do what I am trying to do? I am trying very hard to keep this json file local, as I expect to use it in production as well. Any help would be appreciated!

edit: I see https://github.com/nuxt/nuxt.js/issues/123#issuecomment-272246782 - very helpful! But I'm not sure it solves the nuxt-generate problem. One thing I can think of is to create a small api server to serve my json file for the sole purpose of generating the routes, but if there are better options, I'd gladly take them.

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