I'm trying to import an array into a Vue component:
The (simplified) component:
<script type="text/babel">
const countryCodes = require('./country_codes.js');
export default {
props: [],
data() {
return {
countryCodes: countryCodes
}
},
}
</script>
country_codes.js
(function() {
return ['DE', 'EN']; // This, of course, is way bigger; simplified for readability
});
Both the component and the country_codes.js files are in the same directory, but the countryCodes
property is always an empty object.
What am I doing wrong?