Home

Issue: 3092

Question] Cannot find name process in Typescript

[issue link]

i’m using nuxt with typescript.
but it doesn’t work when using process variable

nuxt.config.js

module.exports = {
    env: {
          apiUrl: '........'
    }

api.js

import axios from 'axios'

const apiUrl = process.env.apiUrl

export function getItem() {
    return axios.get(`${apiUrl}/items`)
}

but when api.js convert to api.ts, then
Cannot find name process in Typescript error occurred
how can i using process.env.apiUrl in typescript file?

This question is available on Nuxt.js community (#c2677)