Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

v5 breaks modules which assign reserved keywords to module.exports #110

Closed
leeyeh opened this issue Sep 18, 2016 · 12 comments
Closed

v5 breaks modules which assign reserved keywords to module.exports #110

leeyeh opened this issue Sep 18, 2016 · 12 comments

Comments

@leeyeh
Copy link

leeyeh commented Sep 18, 2016

Upgrading to v5.0.3 from v4 breaks build:

SyntaxError: /home/travis/build/leancloud/js-realtime-sdk/node_modules/axios/lib/axios.js: Unexpected token (55:4)
  53 | 
  54 | // Allow use of default import syntax in TypeScript
> 55 | var default = axios;
     |     ^
  56 | 
  57 | export default axios_1;
  58 | export { axios_1 as __moduleExports };

The source code of axios looks like:

// Allow use of default import syntax in TypeScript
module.exports.default = axios;
@Rich-Harris
Copy link
Contributor

Hey @leeyeh, I think this is the same as #112 which was just fixed – can you try the latest version and see if it's 👍 ? Thanks

@leeyeh
Copy link
Author

leeyeh commented Sep 19, 2016

still broken https://travis-ci.org/leancloud/js-realtime-sdk/builds/160891784#L1648

I believe this issue is about reserved keywords.

@leeyeh leeyeh changed the title v5 breaks modules which assign something to exports.default v5 breaks modules which assign 'default' to module.exports Sep 19, 2016
@lxe
Copy link
Contributor

lxe commented Sep 19, 2016

Same things with "delete" and other reserved keywords

@leeyeh leeyeh changed the title v5 breaks modules which assign 'default' to module.exports v5 breaks modules which assign reserved keywords to module.exports Sep 21, 2016
@dhndeveloper
Copy link

Having a similar issue...

@youzi
Copy link

youzi commented Dec 9, 2016

I'm having a similar issue with a dependency defining: exports.static = function () {}

Error parsing x: The keyword 'static' is reserved (23:4) in x

I'm using 'rollup-plugin-commonjs@5.0.5' in combination with 'rollup-plugin-node-resolve@2.0.0'

@youzi
Copy link

youzi commented Dec 9, 2016

Ok so seems to be an Acorn issue. I was able to work around this by passing options to Acorn: rollup/rollup#564

@Rich-Harris
Copy link
Contributor

This is the same issue as #116, I think – have just released 6.0.0 with a fix. Let me know if you still have problems, thanks

@mortargrind
Copy link

This is broken in version 7.0.0. When you try to import axios from 'axios';, you'll get Error: Duplicate export 'default'. When you delete module.exports.default = axios; line in the "node_modules/axios/lib/axios.js", it will compile (I don't know if the output will be correct, i have other errors :) ) Acorn option allowReserverd: true does not solve this.

@lukasjuhas
Copy link

I'm having same problem @mortargrind. Thanks for the tip, it does work if I comment out / delete that line.

@leeyeh
Copy link
Author

leeyeh commented Feb 3, 2017

I can confirm it's still broken for the keyword default: https://travis-ci.org/leancloud/js-realtime-sdk/builds/190498378#L1205

I can file a new issue if preferred. @Rich-Harris

@Rich-Harris
Copy link
Contributor

I think this will have been fixed by #173 — could you try installing the latest version to see? Thanks, sorry for the delayed response

@leeyeh
Copy link
Author

leeyeh commented Mar 8, 2017

Confirmed. Thank you.

@leeyeh leeyeh closed this as completed Mar 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants