If you're using import { something } from './config.ts'
, you're using JavaScript modules, but your code in config.ts
is using CommonJS modules. Some bundlers and such may let you mix them, but it's best not to.
To make config.ts
a JavaScript module compatible with that import
declaration (which expects a named export called something
), change it to:
export const something = 123;
Or, of course, to use config.ts
via CommonJS, your code using it would be:
const { something } = require("./config.ts");
...but given the error you're getting, I think your project is set up to use JavaScript modules (import
/export
), which here in almost 2021 is probably best (now that we have dynamic import to handle the cases where static modules don't quite do the job).