For some reason I'm unable to use an array exported as an es6 module:
export const choices = [
['first', 'First'],
['second', 'Second'],
['third', 'Third'],
]
Then:
import { choices } from './constants'
console.log(choices) // undefined
If I simply declare the const
in the same file where I'm trying to use it, it works as expected.
Modules in browser contexts use relative URLs, including extension. So the import should be from './constants.js'
rather than just from './constants'
. (The latter would be fine on Node.js, though, with its currently-experimental modules support.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With