1

I want my config file optional, I thought of this solution, check if the config file exists and conditionally import my config file but I get An import declaration can only be used in a namespace or module.deno-ts(1232).

app.ts

import {existsSync} from 'https://deno.land/std/fs/mod.ts'

if (existsSync('./myconfig.ts')) {
  import {config} from './myconfig.ts'
}

myconfig.ts

export const config: any = {
  config: "value"
}
Hunam
  • 69
  • 1
  • 10

0 Answers0