As we know, this a syntax of ES6 of exporting a variable.
export const LANGUAGE = 'JavaScript'
and this is a way of declaration of the same code in ES5:
exports.LANGUAGE = 'JavaScript'
but in some other cases it doesn't work, like for reserved words and for names which includes spaces:
exports.true = '#true'
exports['some text'] = 'text'
so what is the right way of declaring exports in ES6 ?
You can't use the export const varName = 'Value'
syntax with a reserved word; please read the following statement on ECMAScript 6 modules: the final syntax:
Note that you can’t use reserved words (such as default and new) as variable names, but you can use them as names for exports (you can also use them as property names in ECMAScript 5). If you want to directly import such named exports, you have to rename them to proper variables names.
According to that, it looks like you should be able to do something along the lines of:
const true_ = '#true';
export { true_ as true };
Please note that this will also cause problems on the importing side as well. You will most likely need to re-alias on import. E.g.,
import { true as true_ } from '...';