Reputation: 65
I want to import config.js which includes project's API keys. But It returns undefined.
//config.js
var config = {
fbAPI: "key"
}
-
//nuxt.config.js
const cfg = require('./config')
env: {
fbAPI: cfg.apiKey
}
Is this problem about run-time or am I missing something?
Upvotes: 3
Views: 4985
Reputation: 191
You missed modules.export
at the end of config.js
. The file should look following:
var config = {
fbAPI: "key"
}
module.exports = config;
Upvotes: 4