importing into app.config.js

sdk version: 39.0.2
platform: web

Hi there, I’m trying to import some values in to my app.config.js file. For reasons I won’t bore you with here, we keep config values in a file like this:

Config.js

const Config = {
  myConfigVar: "foo"
}

export default Config

But when I try and import and use this Config object in our app.config.js file:

app.config.js

import Config from "./Config"

export default {
    name: "A name with a config var " + Config.myConfigVar
};

I get the following error when running expo start --web:

Unexpected token export
Error
    at readConfigFile (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/config/src/getConfig.ts:22:21)
    at Object.getDynamicConfig (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/config/src/getConfig.ts:30:18)
    at getConfig (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/config/src/Config.ts:133:62)
    at configureProjectAsync (/usr/local/lib/node_modules/expo-cli/src/commands/start.ts:283:25)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.