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

Error: Configuration contains explicit test/include/exclude checks, but no filename was passed to Babel #1659

Closed
elmpp opened this issue May 16, 2018 · 1 comment

Comments

@elmpp
Copy link

elmpp commented May 16, 2018

Hi there,

I'm trying to bumble my way through to having a working babel7-based setup but there seems to be something wrong the moment i pull in "babel-plugin-inline-import-graphql-ast"

Here is my babel.config.js (this is now the babel7 method to specify a project-wide babel config, in lieu of .babelrc):

// https://github.com/babel/babel/pull/7358#issuecomment-388311941
module.exports = {
  overrides: [{
    test: '*',
    presets: [
      ['@babel/preset-env', {'node': 'current'}],
    ],
    plugins: [
      [
        "babel-plugin-inline-import",
        {
          extensions: [
            ".css"
          ]
        }
      ],
      "babel-plugin-inline-import-graphql-ast"
    ],
    env: {
      development: {
        presets: [
          "next/babel",
        ]
      },
      production: {
        presets: [
          [
            "next/babel",
            {
              ["preset-env"]: {
                targets: {
                  browsers: "> 5%"
                }
              }
            }
          ]
        ]
      },
      test: {
        presets: [
          [
            "next/babel",
            {
              ["preset-env"]: {
                modules: true
              }
            }
          ]
        ]
      }
    }
  }],
  ignore: [
    "/*.plain/"
  ]
}

Example usage of the graphql inlining:

# ---- https://github.com/apollographql/graphql-tag
#import "./Category3Fragment.graphql"
#import "./Category2Fragment.graphql"
#import "./Category1Fragment.graphql"


query Category1(
  $canonicalised_name: String,
  $category1__canonicalised_name: String,
) {
  category1 (
    canonicalised_name: $canonicalised_name,
    category1__canonicalised_name: $category1__canonicalised_name,
  ) {
      ...Category1Fragment
  }
}

Babel version:

Matthews-MacBook-Pro:frontend matt$ yarn list @babel/node @babel/core babel-loader babel-plugin-inline-import-graphql-ast
yarn list v1.6.0
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ @babel/core@7.0.0-beta.47
├─ @babel/node@7.0.0-beta.44
├─ babel-loader@8.0.0-beta.2
└─ babel-plugin-inline-import-graphql-ast@2.3.7
✨  Done in 0.63s.

Error text:

Module build failed: Error: Configuration contains explicit test/include/exclude checks, but no filename was passed to Babel
    at configFieldIsApplicable (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/config/config-chain.js:401:11)
    at configIsApplicable (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/config/config-chain.js:396:41)
    at forEach (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/config/config-chain.js:242:13)
    at Array.forEach (<anonymous>)
    at /Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/config/config-chain.js:239:42
    at buildRootChain (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/config/config-chain.js:90:20)
    at loadPrivatePartialConfig (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/config/partial.js:51:55)
    at loadFullConfig (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/config/full.js:43:39)
    at transformSync (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/lib/transform-sync.js:15:38)
    at buildVariableAST (/Users/matt/dev/partridge/frontend/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:87:58)
    at /Users/matt/dev/partridge/frontend/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:72:26
    at Array.map (<anonymous>)
    at buildReplacements (/Users/matt/dev/partridge/frontend/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:65:31)
    at PluginPass.exit (/Users/matt/dev/partridge/frontend/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:59:34)
    at newFn (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:237:21)
    at NodePath._call (/Users/matt/dev/partridge/frontend/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:65:20)

I appreciate this seems to be specific to the "babel-plugin-inline-import-graphql-ast" plugin but am a little unclear as to whether plugin authors need to update to become "babel7 compatible" or whether i'm likelier doing something wrong here

@loganfsmyth
Copy link
Member

Closing in favor of detrohutt/babel-plugin-import-graphql#30

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

No branches or pull requests

2 participants