This repository was archived by the owner on Aug 4, 2021. It is now read-only.
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
Reserved keywords as properties of module.exports are transpiled into named exports, which causes "unexpected token" errors. #116
Closed
Description
Consider:
module.exports.delete = 'foo';
This will get transpiled into:
var delete = 'foo';
var mycjsmodule = {
delete: delete
};
export default mycjsmodule;
export { mycjsmodule as __moduleExports };
export { delete };
Which will cause a SyntaxErrors on var delete = 'foo';
and export { delete };
Since it's impossible to do EDIT: Apparently it's possible to import a reserved keyword like that, as long as it's destructured, at least according to babel! Not sure if that's desired behavior.import { delete } from './mycjsmodule'
anyways, it would be safe to not create named exports for reserved-keyword properties of module.exports.
Metadata
Metadata
Assignees
Labels
No labels