I want to import firebase in nuxt.config.js to get data from firestore for genereting dynamic route. but it show error :
SyntaxError: Cannot use import statement outside a module
here is my code and error :

this is for generating dynamic route:

Please use export default instead of module.exports if you want to use the import statement.
@Atinux Sorry Sir. but it still does not work with me.

i am importing firebase from plugins.

I see you use server/index.js
So you need to use const { db } = require(‘../plugins/firebase’) and use module.exports
@Atinux after i use const { db } = require(‘../plugins/firebase’) and module.exports , it shows me this error. How can i fix this ,Sir?

Has this issue been resolved? I have the same problem with VuePictureSwipe..
I just started seeing the same issue, but only when running with 'production' env in Azure App Service. It started after I switched from Linux to Windows App Service Plan. It works fine when running locally - both with nuxt-ts and nuxt-ts build & nuxt-ts start.
Version: nuxt: 2.13.0
After changing import statements to require, I'm getting the similar problem
const colors = require('vuetify/es5/util/colors')
// eslint-disable-next-line nuxt/no-cjs-in-config
module.exports = {
//...config
nuxt-ts build
FATAL Cannot read property 'darken2' of undefined 12:30:41
TypeError: Cannot read property 'darken2' of undefined
at Object.<anonymous> (nuxt.config.js:125:32)
at Generator.next (<anonymous>)
// EDIT
Alright, I'm getting the same error locally as I'm getting in Azure (SyntaxError: Cannot use import statement outside a module) if I start the application with node ./server/index.js.
I'm a little bit confused now - what's the preferred way to start an SSR application in Azure? Should I start it with nuxt-ts start or node ./server/index.js? Probably a dumb question, but can't see this being documented anywhere
// EDIT2
I solved the problem with vuetify colors with optionsPath option. However, now it's a different error - but not related to this issue.