leebyron / iterall

🌻 Minimal zero-dependency utilities for using Iterables in all JavaScript environments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: Unknown plugin "remove-comments"

LeoLeBras opened this issue · comments

Hi 😀,

First of all - thank you for maintaining this repo.


I'm trying to update iterall to v1.2.1 in a react-native app (version 0.44.3) but my packager displays the following error :

ReferenceError: Unknown plugin "remove-comments" specified in "myApp/node_modules/iterall/package.json" at 0, attempted to resolve relative to "myApp/node_modules/iterall"

Maybe it would be better to separate the babel configuration in a .babelrc file and ignore this .babelrc file in .npmignorefile ?

Greetings from Paris

Thanks for the report. I didn’t realize react native attempts to read the Babel config of node modules. I think your suggestion of a repo-only .babelrc is the right thing to do

I just ran into this issue too. What part of my setup is to blame for this? I'm also running react-native and getting a lot of errors for packages that list devDependencies.

I also just started having this issue, I'm using TypeScript and parcel.

I believe the react-native bundler incorrectly attempts to perform babel transforms on the node_modules directory. I'll try to remove the reference to the babel transforms from the npm package so they're not found.

Would that be causing issues for me too? I'm not using the react-native bundler.

@cruhl Does your TypeScript setup use Babel at all? The more general issue is looking to apply Babel transforms within the node_modules folder - typically babel excludes this directory by default but custom configurations can sometimes accidentally remove this exclusion

I am not using default metro bundler of React Native, but Haul which gives me full power of Webpack underneath. I've inspected default configuration it comes with and it's kinda understandable why it fails. However trying to add the exclude would be rather hacky. Also removing babel plugin completely (I am using Typescript as well) breaks other things (even React Native itself)

{
  test: /\.js$/,
  exclude: /node_modules\/(?!react|@expo|pretty-format|haul)/,
  use: [
    [0] {
      loader: 'D:\workspace\app\node_modules\haul\node_modules\thread-loader\dist\cjs.js'
    },
    [1] {
      loader: 'D:\workspace\app\node_modules\haul\node_modules\babel-loader\lib\index.js',
      options: {
        extends: 'D:\workspace\app\.babelrc',
        plugins: [
          [0] 'D:\workspace\app\node_modules\haul\src\utils\fixRequireIssues.js',
          [1] 'D:\workspace\app\node_modules\react-hot-loader\babel.js',
          [2] 'D:\workspace\app\node_modules\haul\src\hot\babelPlugin.js'
        ],
        cacheDirectory: true
      }
    }
  ]
}

Anyway, I can confirm that by removing babel config from package.json it works just fine, so it's the only issue it seems.

Just released v1.2.2 that includes the fix for this issue