Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken by recent commit to babel? #2

Closed
jbcpollak opened this issue Feb 17, 2016 · 18 comments
Closed

Broken by recent commit to babel? #2

jbcpollak opened this issue Feb 17, 2016 · 18 comments
Labels

Comments

@jbcpollak
Copy link

Is it just me or does this commit break this library?

https://github.com/babel/babel/pull/3303/files

now I get something like this:

ERROR in ./lib/index.js
Module build failed: TypeError: Falsy value found in plugins
    at /.../node_modules/babel-core/lib/transformation/file/options/option-manager.js:187:15
    at Array.map (native)
    at Function.normalisePlugins (/.../node_modules/babel-core/lib/transformation/file/options/option-manager.js:182:20)
    at OptionManager.mergeOptions (/.../node_modules/babel-core/lib/transformation/file/options/option-manager.js:298:36)
....
@developit
Copy link
Owner

@jbcpollak are you using NPM 2, or 3?

@jbcpollak
Copy link
Author

Npm 3!
On Wed, Feb 17, 2016 at 6:59 PM Jason Miller notifications@github.com
wrote:

@jbcpollak https://github.com/jbcpollak are you using NPM 2, or 3?


Reply to this email directly or view it on GitHub
#2 (comment)
.

@developit
Copy link
Owner

Yeah I think this is an issue with require-relative and npm 3.

@akhilshastri
Copy link

Hi, I m facing the same issue "TypeError: Falsy value found in plugins", any updates for it..?

@developit
Copy link
Owner

@akhilshastri I have some work locally to fix this, but it's not working yet.

@developit
Copy link
Owner

Anyone having this issue, please try installing modify-babel-preset@beta (2.0.1). Thanks.

@crostonj
Copy link

crostonj commented Apr 6, 2016

Has this been addressed? I am having the same issue.

@developit
Copy link
Owner

@crostonj Have you tried 2.0.1 (npm install modify-babel-preset@beta)?

@crostonj
Copy link

crostonj commented Apr 6, 2016

I installed it before I posted this question and I still get the error. Do I have configure it somehow? I am trying to use it with webpack and get the error when I try to compile the bundle.

@developit
Copy link
Owner

There isn't really configuration, no. Can you paste your call to modifyBabelPreset()?

@crostonj
Copy link

crostonj commented Apr 6, 2016

I guess that is the trick, I am not sure how to integrate it into the webpack.config to build the bundle.

Here is my current config:

var path = require('path');
var webpack = require('webpack');

var schema = require('./src/data/schema.json').data;
var babelRelayPlugin = require('babel-relay-plugin');

module.exports = {
  entry: "./src/main.js",
  output: {
    path: __dirname + "/public",
    filename: "bundle.js"
  },
  module: {
    loaders: [
      { 
          test: /\.js$/, 
          exclude: /node_modules/,
          loader: 'babel-loader',
          query: {
            presets: ['react', 'es2015', 'stage-0'],
            plugins: [
               babelRelayPlugin(schema)
                ]
          }
      }
    ]
  }
};

this is the error I get when I run webpack:

ERROR in ./src/main.js
Module build failed: TypeError: Falsy value found in plugins
    at E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:160:15
    at Array.map (native)
    at Function.normalisePlugins (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:155:20)
    at OptionManager.mergeOptions (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:277:36)
    at OptionManager.init (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:465:10)
    at File.initOptions (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\index.js:194:75)
    at new File (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\index.js:123:22)
    at Pipeline.transform (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\pipeline.js:45:16)
    at transpile (E:\Projects\RESTGraphQL\node_modules\babel-loader\index.js:14:22)
    at Object.module.exports (E:\Projects\RESTGraphQL\node_modules\babel-loader\index.js:88:12)

@developit
Copy link
Owner

Typically this module is used to create a babel preset that is derived from another babel preset. If you're using it inline, I believe you should be able to do something like this in your webpack.config.babel.js:

import modifyBabelPreset from 'modify-babel-preset';

module.exports = {
  // .. in your babel configuration parameters:
  module: {
    loaders: [
      {
        test: /\.jsx?/,
        exclude: /node_modules/
        loader: 'babel',
        query: {
          plugins: modifyBabelPreset('es2015', {
            // example: reconfigure jsx transform:
            'transform-react-jsx': { pragma: 'h' }
          }).plugins
        }
      },
      // ..etc
    ]
  }
};

@crostonj
Copy link

crostonj commented Apr 7, 2016

Continuing on this today:

var path = require('path');
var webpack = require('webpack');
var modifyBabelPreset = require('modify-babel-preset');
var schema = require('./src/data/schema.json').data;
var babelRelayPlugin = require('babel-relay-plugin');


module.exports = {
    entry: "./src/main.js",
    output: {
        path: __dirname + "/public",
        filename: "bundle.js"
    },
    module: {
        loaders: [{
            test: /\.js$/,
            exclude: /node_modules/,
            loader: 'babel-loader',
            query: {
                presets: ['react', 'es2015', 'stage-0'],
                plugins: [
                    modifyBabelPreset('es2015').plugins,
                    babelRelayPlugin(schema)
                ]
            }
        }]
    }
};

and I get the following error:


ERROR in ./src/main.js
Module build failed: TypeError: Cannot read property '__esModule' of null
    at Function.normalisePlugin (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:138:20)
    at E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:183:30
    at Array.map (native)
    at Function.normalisePlugins (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:155:20)
    at OptionManager.mergeOptions (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:277:36)
    at OptionManager.init (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\options\option-manager.js:465:10)
    at File.initOptions (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\index.js:194:75)
    at new File (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\file\index.js:123:22)
    at Pipeline.transform (E:\Projects\RESTGraphQL\node_modules\babel-core\lib\transformation\pipeline.js:45:16)
    at transpile (E:\Projects\RESTGraphQL\node_modules\babel-loader\index.js:14:22)
    at Object.module.exports (E:\Projects\RESTGraphQL\node_modules\babel-loader\index.js:88:12)

@developit
Copy link
Owner

Plugins has to be a flat Array - try this:

var path = require('path');
var webpack = require('webpack');
var modifyBabelPreset = require('modify-babel-preset');
var schema = require('./src/data/schema.json').data;
var babelRelayPlugin = require('babel-relay-plugin');


module.exports = {
    entry: "./src/main.js",
    output: {
        path: __dirname + "/public",
        filename: "bundle.js"
    },
    module: {
        loaders: [{
            test: /\.js$/,
            exclude: /node_modules/,
            loader: 'babel-loader',
            query: {
                presets: ['react', 'es2015', 'stage-0'],
                plugins: [].concat(
                    modifyBabelPreset('es2015').plugins,
                    [
                      babelRelayPlugin(schema)
                    ]
                )
            }
        }]
    }
};

@developit
Copy link
Owner

Closing this since I'm fairly certain it's an issue that arises when plugins that do not exist are referenced. Please re-open if this is still an issue for you!

@mykhailo-ivankiv
Copy link

mykhailo-ivankiv commented Jul 14, 2016

Hi. I have the same problem with babelRelayPlugin.
I have tried to use modifyBabelPreset but it do not work at my environment.

node -v = v6.1.0, npm -v = 3.9.0
package.json:

...
"webpack": "^2.1.0-beta.17",
"babel-loader": "^6.2.4",
"babel-relay-plugin": "^0.9.2",
"modify-babel-preset": "^2.0.3",
...

Error

ERROR in ./src/app.server.js
Module build failed: TypeError: Falsy value found in plugins
    at ~/node_modules/babel-core/lib/transformation/file/options/option-manager.js:160:15
    at Array.map (native)
    at Function.normalisePlugins (~/node_modules/babel-core/lib/transformation/file/options/option-manager.js:155:20)
    at OptionManager.mergeOptions (~/node_modules/babel-core/lib/transformation/file/options/option-manager.js:277:36)
    at OptionManager.init (~/node_modules/babel-core/lib/transformation/file/options/option-manager.js:465:10)
    at File.initOptions (~/node_modules/babel-core/lib/transformation/file/index.js:194:75)
    at new File (~/node_modules/babel-core/lib/transformation/file/index.js:123:22)
    at Pipeline.transform (~/node_modules/babel-core/lib/transformation/pipeline.js:45:16)
    at transpile (~/node_modules/babel-loader/index.js:14:22)
    at Object.module.exports (~/node_modules/babel-loader/index.js:88:12)

@developit
Copy link
Owner

@neformal13 hmm - can you post how you're invoking modify-babel-preset?

@adam-26
Copy link

adam-26 commented Sep 26, 2016

FYI: I found this error also occurs if you have an EMPTY presets: [] array in a preset. I haven't checked to see if the same occurs with an empty plugins:[] array, but I'd avoid having any empty arrays to be safe.

Would be nice if babel could handle this condition :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants