plugins icon indicating copy to clipboard operation
plugins copied to clipboard

`(plugin commonjs) SyntaxError: Unexpected token typeof`

Open kamleshchandnani opened this issue 4 years ago • 9 comments

  • Rollup Plugin Name: commonjs
  • Rollup Plugin Version: 21.0.1
  • Rollup Version: 2.61.1
  • Operating System (or Browser): MacOS 11.6
  • Node Version: 16.13.0
  • Link to reproduction (⚠️ read below): https://github.com/razorpay/blade/pull/391

Steps to reproduce:

  1. Clone the repository
  2. Checkout this branch
  3. Run yarn at the repo root

Expected Behavior

After I upgraded the babel packages from versions 7.14.x to 7.16.x my rollup builds starts failing. Specifically the @rollup/plugin-commonjs. It starts throwing below error

[!] (plugin commonjs) SyntaxError: Unexpected token (14:7) in /home/runner/work/blade/blade/packages/blade/node_modules/react-native/index.js
node_modules/react-native/index.js (14:7)
12: 
13: // Components
14: import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';

Here's the github action link to see the exact error details

While upgrading I also upgraded the commons plugin version to 21.x and then again tried reverting that but seems like there's something which commonjs plugin is not liking and it's difficult to identify from the logs what exactly is going wrong.

Although the project is running absolutely fine, the tests are passing too which means it's not necessarily the problem with babel?

Actual Behavior

The plugin shall transform and build successfully.

Additional Information

Here's my rollup.config.js. There's no change in the rollup config, just the packages have been upgraded.

kamleshchandnani avatar Dec 15 '21 15:12 kamleshchandnani

Thanks for opening an issue. Citing the issue template:

🚨 Issues WITHOUT a valid reproduction WILL BE CLOSED!

Please provide one by:

  1. Using the REPL.it plugin reproduction template at https://repl.it/@rollup/rollup-plugin-repro
  2. Provide a minimal repository link (Read https://git.io/fNzHA for instructions). Please use NPM for installing dependencies! These may take more time to triage than the other options.
  3. Using the Rollup REPL at https://rollupjs.org/repl/

⚠️ ZIP Files are unsafe and maintainers will NOT download them.

We cannot make this any clearer. Please add a reproduction and we'll be happy to triage further.

shellscape avatar Dec 15 '21 15:12 shellscape

Hey @shellscape I linked to a repro branch in the description with steps to reproduce the issue as well. 🤔

Putting the branch here again - https://github.com/razorpay/blade/tree/add-storybook

kamleshchandnani avatar Dec 15 '21 15:12 kamleshchandnani

@kamleshchandnani we have three options for a valid reproduction. See my reply above. What you've provided doesn't match any of our accepted options. It's not the maintainer's job here to wade through complex repositories. Please choose one of the options we accept so that your issue is isolated, and we'll be happy to reopen the issue for triage.

shellscape avatar Dec 15 '21 15:12 shellscape

@kamleshchandnani Did you fix that? I have a same problem in my project.

SixiCat avatar Jan 10 '22 08:01 SixiCat

Same problem here, any fix ? @kamleshchandnani @SixiCat

AmirTahani avatar Feb 23 '22 14:02 AmirTahani

Same issue on ubuntu

Stevemoretz avatar Mar 03 '22 16:03 Stevemoretz

Please do not reply with "same," "me too," or +1. Please use the reaction buttons on the issue instead.

shellscape avatar Mar 03 '22 16:03 shellscape

To clarify I have this problem on Ubuntu same config works on MacOS 10.15 for me. So it's not exactly the same issue.

Stevemoretz avatar Mar 03 '22 16:03 Stevemoretz

OK thanks for clarifying

shellscape avatar Mar 03 '22 17:03 shellscape