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

Babel loader broken. #3

Closed
NathHorrigan opened this issue Jul 19, 2019 · 8 comments
Closed

Babel loader broken. #3

NathHorrigan opened this issue Jul 19, 2019 · 8 comments

Comments

@NathHorrigan
Copy link

The most recent changes from this PR (gatsbyjs/gatsby#15875) seem to have broken the babel-loader and it is not throwing the following errors:

TypeError: Cannot read property 'plugins' of undefined
    at prepareOptions (.../node_modules/gatsby/dist/utils/babel-loader-helpers.js:62:35)
@DSchau
Copy link

DSchau commented Jul 22, 2019

@NathHorrigan could you supply a reproduction?

This shouldn’t be an issue with new projects — but it’s possible something has been broken that your project was relying upon (e.g. a custom babel config file).

Thanks!

@NathHorrigan
Copy link
Author

NathHorrigan commented Jul 22, 2019

I could throw together a reproduction but are you sure there are no effects? because for example one of the functions called in the babel-loader.js is getCustomOptions:

customOptions(options) {
      return {
        loader: {
          cacheDirectory: true,
          sourceType: `unambiguous`,
          ...getCustomOptions(),
          ...options,
        },
      }
    },

However, getCustomOptions now requires a stage param which isn't passed?

My apologies if I'm missing something here.

@DSchau
Copy link

DSchau commented Jul 22, 2019

@NathHorrigan where are you seeing that line?

Here’s the actual invocation, where you can see stage is passed.

@braican
Copy link

braican commented Jul 22, 2019

I'm also having a similar issue. I've created a project reproducing the issue I'm seeing here.

I agree with @NathHorrigan that something introduced in Gatsby core over the past couple of days has impacted this plugin. When using Gatsby version 2.13.27, everything works great. Upon doing a reinstallation this afternoon of an existing project (and subsequently upgrading Gatsby to version 2.13.32), I began seeing issues in this project's babel-loader.js while running gatsby develop. Specifically starting with:

Module build failed (from ./node_modules/gatsby-source-graphql-universal/babel-loader.js):
TypeError: Cannot read property 'options' of undefined

I'm using the gatsby-source-prismic-graphql plugin (version 3.3.1) to pull in content from Prismic, which in turn references gatsby-source-graphql-universal version v3.1.4 as a dependency. While using Gatsby version 2.13.32, when I run gatsby develop, I get the following error:

success open and validate gatsby-configs - 0.028 s
success load plugins - 0.172 s
success onPreInit - 0.017 s
success initialize cache - 0.034 s
success copy gatsby files - 0.082 s
success onPreBootstrap - 0.023 s
success source and transform nodes - 1.029 s
success building schema - 0.137 s
success createPages - 0.032 s
success createPagesStatefully - 0.073 s
success onPreExtractQueries - 0.016 s
success update schema - 0.038 s
success extract queries from components - 0.292 s
success write out requires - 0.044 s
success write out redirect data - 0.025 s
success onPostBootstrap - 0.019 s
⠀
info bootstrap finished - 21.911 s
⠀
success run static queries - 0.018 s
success run page queries - 0.048 s — 3/3 102.46 queries/second
 ERROR  Failed to compile with 2 errors                                                                                                                                                                                                                                                                                                                                     1:06:50 PM
⠀
 error  in ./.cache/app.js
⠀
Module build failed (from ./node_modules/gatsby-source-graphql-universal/babel-loader.js):
TypeError: Cannot read property 'options' of undefined
    at getCustomOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby/dist/utils/babel-loader-helpers.js:26:42)
    at Object.customOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby-source-graphql-universal/babel-loader.js:36:12)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:95:52)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:194)
    at /Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:364
    at new Promise (<anonymous>)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:97)
    at Object.loader (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:60:18)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:55:12)

 @ multi ./node_modules/event-source-polyfill/src/eventsource.js (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
⠀
 error  in ./.cache/react-lifecycles-compat.js
⠀
Module build failed (from ./node_modules/gatsby-source-graphql-universal/babel-loader.js):
TypeError: Cannot read property 'options' of undefined
    at getCustomOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby/dist/utils/babel-loader-helpers.js:26:42)
    at Object.customOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby-source-graphql-universal/babel-loader.js:36:12)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:95:52)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:194)
    at /Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:364
    at new Promise (<anonymous>)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:97)
    at Object.loader (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:60:18)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:55:12)

 @ ./node_modules/react-hot-loader/dist/react-hot-loader.development.js 13:22-56
 @ ./node_modules/react-hot-loader/index.js
 @ (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false
 @ multi ./node_modules/event-source-polyfill/src/eventsource.js (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
⠀
✖ 「wdm」:
ERROR in ./.cache/app.js
Module build failed (from ./node_modules/gatsby-source-graphql-universal/babel-loader.js):
TypeError: Cannot read property 'options' of undefined
    at getCustomOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby/dist/utils/babel-loader-helpers.js:26:42)
    at Object.customOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby-source-graphql-universal/babel-loader.js:36:12)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:95:52)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:194)
    at /Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:364
    at new Promise (<anonymous>)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:97)
    at Object.loader (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:60:18)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:55:12)
 @ multi ./node_modules/event-source-polyfill/src/eventsource.js (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app commons[2]

ERROR in ./.cache/react-lifecycles-compat.js
Module build failed (from ./node_modules/gatsby-source-graphql-universal/babel-loader.js):
TypeError: Cannot read property 'options' of undefined
    at getCustomOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby/dist/utils/babel-loader-helpers.js:26:42)
    at Object.customOptions (/Users/braican/Projects/braican/bug-repro/node_modules/gatsby-source-graphql-universal/babel-loader.js:36:12)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:95:52)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:194)
    at /Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:364
    at new Promise (<anonymous>)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:5:97)
    at Object.loader (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:60:18)
    at Object.<anonymous> (/Users/braican/Projects/braican/bug-repro/node_modules/babel-loader/lib/index.js:55:12)
 @ ./node_modules/react-hot-loader/dist/react-hot-loader.development.js 13:22-56
 @ ./node_modules/react-hot-loader/index.js
 @ (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false
 @ multi ./node_modules/event-source-polyfill/src/eventsource.js (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
ℹ 「wdm」: Failed to compile.

Similarly, gatsby build errors out as well while trying to build the js bundles:

$ gatsby build
success open and validate gatsby-configs - 0.037 s
success load plugins - 0.205 s
success onPreInit - 0.017 s
success delete html and css files from previous builds - 0.023 s
success initialize cache - 0.023 s
success copy gatsby files - 0.092 s
success onPreBootstrap - 0.026 s
success source and transform nodes - 0.106 s
success building schema - 0.148 s
success createPages - 0.035 s
success createPagesStatefully - 0.054 s
success onPreExtractQueries - 0.015 s
success update schema - 0.035 s
success extract queries from components - 0.257 s
success write out requires - 0.017 s
success write out redirect data - 0.015 s
success onPostBootstrap - 0.016 s
⠀
info bootstrap finished - 4.771 s
⠀
success run static queries - 0.015 s

 ERROR #98123  WEBPACK

Generating JavaScript bundles failed

Cannot read property 'options' of undefined

File: .cache/production-app.js

⠦ Building production JavaScript and CSS bundles
error Command failed with exit code 1.

Again, when I downgrade to Gatsby version 2.13.27, both gatsby develop and gatsby build work as expected.

@birkir
Copy link
Owner

birkir commented Jul 22, 2019

I will take a look at this. We are monkey patching gatsby's graphql system so this is to be expected every now and then with major and minor releases but shouldn't be a problem with patches.

Will keep you posted

@Exegetech
Copy link

Currently breaks for me as well...

@birkir
Copy link
Owner

birkir commented Jul 29, 2019

Should be fixed with 3.1.6

@birkir birkir closed this as completed Jul 29, 2019
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

5 participants