Either this is a bug, or I’m dumb and don’t know JavaScript nearly as well as I thought…
This code fails (test === undefined
):
import * as routes from '/client/routes.jsx';
const test = routes.ROUTE_DASHBOARD; //yes, this is truly defined and exported
But this works:
import * as routes from '/client/routes.jsx';
export default class MyComponent extends Component {
render() {
const test = routes.ROUTE_DASHBOARD; // test === 'dashboard'
}
}
Is there some reason this imported constant wouldn’t be available outside the scope of the React component?