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

Missing class properties transform #31853

Closed
ionTea opened this issue Jun 10, 2021 · 20 comments · Fixed by #31857
Closed

Missing class properties transform #31853

ionTea opened this issue Jun 10, 2021 · 20 comments · Fixed by #31857
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@ionTea
Copy link

ionTea commented Jun 10, 2021

Description

The build command crashes after updating to v3.7:

yarn run v1.19.1
$ gatsby build --verbose
verbose set gatsby_log_level: "verbose"
verbose set gatsby_executing_command: "build"
verbose loading local command from: /tlp-website/node_modules/gatsby/dist/commands/build.js
verbose running command: build
success open and validate gatsby-configs - 2.571s
success load plugins - 5.280s
success onPreInit - 0.050s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's no stale data.
success initialize cache - 2.482s
success copy gatsby files - 0.121s
verbose Attaching functions to development server
success Compiling Gatsby Functions - 0.615s
success onPreBootstrap - 1.559s
success createSchemaCustomization - 0.180s
verbose Checking for deleted pages
verbose Deleted 0 pages
verbose Found 0 changed pages
success Checking for changed pages - 0.004s
success source and transform nodes - 0.710s
success building schema - 0.636s
success createPages - 23.034s
verbose    PageCreator: Creating 4 pages from {MarkdownRemark.frontmatter__slug}.tsx
success createPagesStatefully - 0.099s
info Total nodes: 8769, SitePage nodes: 8696 (use --verbose for breakdown)
verbose Number of node types: 9. Nodes per type: Directory: 3, File: 15, GraphQLSource: 1, ImageSharp: 3, MarkdownRemark: 4, Site: 1, SiteBuildMetadata: 1, SitePage: 8696,
SitePlugin: 45
verbose Checking for deleted pages
verbose Deleted 0 pages
verbose Found 8696 changed pages
success Checking for changed pages - 0.004s
success Cleaning up stale page-data - 0.271s
success update schema - 15.253s
success onPreExtractQueries - 0.001s
success extract queries from components - 0.950s
success write out redirect data - 0.002s
success Build manifest and related icons - 0.075s
success onPostBootstrap - 0.079s
info bootstrap finished - 62.397s
success run static queries - 0.389s - 2/2 5.15/s
success run page queries - 5.268s - 8696/8696 1650.84/s
success write out requires - 0.033s
failed Building production JavaScript and CSS bundles - 84.844s

 ERROR #98123  WEBPACK

Generating JavaScript bundles failed

/tlp-website/.cache/loader.js: Missing class properties transform.
  101 |   }
  102 |
> 103 |   inFlightNetworkRequests = new Map()
      |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  104 |
  105 |   memoizedGet(url) {
  106 |     let inFlightPromise = this.inFlightNetworkRequests.get(url)

File: .cache/loader.js


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to reproduce

I updated from "gatsby": "^3.6.2" => "gatsby": "^3.7.0" and ran into this issue. Not sure what is causing it yet.
I see that there's been some updates to configs in this release, and I do export a config:

// gatsby-node
exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    resolve: {
      alias: {
        path: require.resolve("path-browserify"),
      },
      fallback: {
        fs: false,
      },
    },
  })
}

The crash does however persist if I remove this config.

Expected result

Gatsby should build without issues.

Actual result

The build crashes with what looks like a babel issue? Not 100% sure what's causing it yet.

Environment

  System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    Yarn: 1.22.10 - ~/tlp-website/node_modules/.bin/yarn
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
  Languages:
    Python: 3.7.1 - /Users/jonathan/anaconda3/bin/python
  Browsers:
    Safari: 14.1.1
  npmPackages:
    gatsby: ^3.7.0 => 3.7.0
    gatsby-image: ^3.7.0 => 3.7.0
    gatsby-plugin-advanced-sitemap: ^2.0.0 => 2.0.0
    gatsby-plugin-codegen: ^1.3.0-next => 1.3.0-next
    gatsby-plugin-google-tagmanager: ^3.7.0 => 3.7.0
    gatsby-plugin-manifest: ^3.7.0 => 3.7.0
    gatsby-plugin-material-ui: ^3.0.1 => 3.0.1
    gatsby-plugin-offline: ^4.7.0 => 4.7.0
    gatsby-plugin-react-helmet: ^4.7.0 => 4.7.0
    gatsby-plugin-sharp: ^3.7.0 => 3.7.0
    gatsby-plugin-webfonts: ^2.1.0 => 2.1.0
    gatsby-remark-autolink-headers: ^4.4.0 => 4.4.0
    gatsby-source-filesystem: ^3.7.0 => 3.7.0
    gatsby-source-graphql: ^3.7.0 => 3.7.0
    gatsby-transformer-remark: ^4.4.0 => 4.4.0
    gatsby-transformer-sharp: ^3.7.0 => 3.7.0

No flags in my gatsby-config

@ionTea ionTea added the type: bug An issue or pull request relating to a bug in Gatsby label Jun 10, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 10, 2021
@LekoArts LekoArts added status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jun 10, 2021
@LekoArts
Copy link
Contributor

Thanks for the issue! We're also seeing this on the default blog starter and are investigating it (cc @vladar). Our current theory is that a recent babel update broke things (upstream).

@vladar
Copy link
Contributor

vladar commented Jun 10, 2021

For now one workaround to try: remove yarn.lock (or package-lock.json) and re-install dependencies.

@elrumordelaluz
Copy link
Contributor

Facing the same issue and can confirm that the workaround proposed by @vladar works perfect:

rm -rf yarn.lock node_modules && yarn

@vladar
Copy link
Contributor

vladar commented Jun 10, 2021

The fix is published in gatsby@3.7.1

@Emptymu
Copy link

Emptymu commented Sep 24, 2021

I'm having the same issue with gatsby 3.10.1 inside a pnpm monorepo. When I go into babel-preset-gatsby/index.js, I'm able to log out the returned babel config where plugin-proposal-class-properties was successfully resolved. Deleting the pnpm-lock.yaml and reinstall all dependencies didn't work for me 😢

> gatsby build

success open and validate gatsby-configs, load plugins - 2.103s
success onPreInit - 0.037s
success initialize cache - 0.052s
success copy gatsby files - 0.125s
success Compiling Gatsby Functions - 0.344s
success onPreBootstrap - 0.364s
success createSchemaCustomization - 0.152s
success Checking for changed pages - 0.002s
success source and transform nodes - 1.995s
success building schema - 0.932s
success createPages - 0.097s
success createPagesStatefully - 0.148s
info Total nodes: 109, SitePage nodes: 21 (use --verbose for
breakdown)
success Checking for changed pages - 0.001s
success Cleaning up stale page-data - 0.003s
success update schema - 0.088s
success onPreExtractQueries - 0.003s
success extract queries from components - 0.734s
success write out redirect data - 0.001s
success Build manifest and related icons - 0.059s
success onPostBootstrap - 0.064s
info bootstrap finished - 10.804s
success run static queries - 0.010s - 2/2 203.42/s
success run page queries - 1.369s - 21/21 15.34/s
success write out requires - 0.005s
failed Building production JavaScript and CSS bundles - 25.331s

 ERROR #98123  WEBPACK

Generating JavaScript bundles failed

/Users/admin/work/my_monorepo/packages/apps/tux_official_websi
te/.cache/loader.js: Missing class properties transform.
  101 |   }
  102 |
> 103 |   inFlightNetworkRequests = new Map()
      |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  104 |
  105 |   memoizedGet(url) {
  106 |     let inFlightPromise =
this.inFlightNetworkRequests.get(url)

File: .cache/loader.js
{
  presets: [
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/@babel+preset-env@7.14.8_@babel+core@7.14.6/node_mod
ules/@babel/preset-env/lib/index.js',
      [Object]
    ],
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/@babel+preset-react@7.14.5_@babel+core@7.14.6/node_m
odules/@babel/preset-react/lib/index.js',
      [Object]
    ]
  ],
  plugins: [
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/babel-preset-gatsby@1.10.0_06114fcf71614dcc795bb7869
8b12418/node_modules/babel-preset-gatsby/optimize-hook-des
tructuring.js',
      [Object]
    ],
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/@babel+plugin-proposal-class-properties@7.14.5_@babe
l+core@7.14.6/node_modules/@babel/plugin-proposal-class-pr
operties/lib/index.js',
      [Object]
    ],
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/@babel+plugin-proposal-nullish-coalescing-operator@7
.14.5_@babel+core@7.14.6/node_modules/@babel/plugin-propos
al-nullish-coalescing-operator/lib/index.js'
    ],
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/@babel+plugin-proposal-optional-chaining@7.14.5_@bab
el+core@7.14.6/node_modules/@babel/plugin-proposal-optiona
l-chaining/lib/index.js'
    ],
    '/Users/admin/work/my_monorepo/node_modules/.p
npm/babel-plugin-macros@2.8.0/node_modules/babel-plugin-ma
cros/dist/index.js',
    '/Users/admin/work/my_monorepo/node_modules/.p
npm/@babel+plugin-syntax-dynamic-import@7.8.3_@babel+core@
7.14.6/node_modules/@babel/plugin-syntax-dynamic-import/li
b/index.js',
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/@babel+plugin-transform-runtime@7.14.5_@babel+core@7
.14.6/node_modules/@babel/plugin-transform-runtime/lib/ind
ex.js',
      [Object]
    ],
    [

'/Users/admin/work/my_monorepo/node_modules/.pnpm/
@babel+plugin-transform-spread@7.14.6_@babel+core@7.14.6/n
ode_modules/@babel/plugin-transform-spread/lib/index.js',
      [Object]
    ],
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/@babel+plugin-transform-classes@7.14.5_@babel+core@7
.14.6/node_modules/@babel/plugin-transform-classes/lib/ind
ex.js',
      [Object]
    ],
    [
      '/Users/admin/work/my_monorepo/node_modules/
.pnpm/babel-plugin-transform-react-remove-prop-types@0.4.2
4/node_modules/babel-plugin-transform-react-remove-prop-ty
pes/lib/index.js',
      [Object]
    ]
  ]
}

@ax-vasquez
Copy link
Contributor

Just wanted to point out that it seems this issue wasn't entirely fixed in 3.7.1

I am currently using version 3.10.1 and just hit this same issue. However, the workaround did work for me. Simply reinstalling the packages worked 🤷

But yeah, looks like this issue may have come back up :/

@mariusbutuc
Copy link

mariusbutuc commented Nov 3, 2021

The fix is published in gatsby@3.7.1

@vladar running gatsby@3.14.4 (as part of the two-step migration process to gatsby@4.x) and the issue/symptoms continue to be present.

failed Building production JavaScript and CSS bundles - 35.751s

 ERROR #98123  WEBPACK

Generating JavaScript bundles failed

[…]/.cache/loader.js: Missing class properties transform.
  101 |   }
  102 |
> 103 |   inFlightNetworkRequests = new Map()
      |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  104 |
  105 |   memoizedGet(url) {
  106 |     let inFlightPromise = this.inFlightNetworkRequests.get(url)

File: .cache/loader.js

# […]

Edit: The workaround #31853 (comment) does work though.

@laradevitt
Copy link
Contributor

Reporting same as above when updating from 3.12.1 to 3.14.5. (Workaround resolves it.)

@axe312ger
Copy link
Collaborator

Got rid of the error via yarn-deduplicate && yarn :)

@koraysels
Copy link

I am still having this error.. even when upgrading to v4... nothing works, tried removeing node_modules and lock files aswel as reinstallign everything. (i do not use yarn)

@koraysels
Copy link

the solution was adding a .babelrc with

{
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }]
  ],
  "presets": [
    [
      "babel-preset-gatsby",
      {
        "targets": {
          "browsers": [">0.25%", "not dead"]
        }
      }
    ]
  ]
}

Leksat added a commit to AmazeeLabs/silverback-mono that referenced this issue Dec 23, 2021
Executed `yarn-deduplicate && yarn` as it was suggested in
gatsbyjs/gatsby#31853 (comment) to fix a gatsby/webpack error
described in gatsbyjs/gatsby#31853
Leksat added a commit to AmazeeLabs/silverback-mono that referenced this issue Dec 23, 2021
Executed `yarn-deduplicate && yarn` as it was suggested in
gatsbyjs/gatsby#31853 (comment) to fix a gatsby/webpack error
described in gatsbyjs/gatsby#31853
@mrlubos
Copy link

mrlubos commented Jan 18, 2022

I've got no idea why removing the lock file works but hey, it really works!

@MoatazAbdAlmageed
Copy link

I got this

Generating JavaScript bundles failed at .cache/loader.js 

/usr/src/app/www/.cache/loader.js: Missing class properties transform.
107 |   }
  108 |
> 109 |   inFlightNetworkRequests = new Map()
      |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  110 |
  111 |   memoizedGet(url) {
  112 |     let inFlightPromise = this.inFlightNetworkRequests.get(url)

For more details see https://gatsby.dev/issue-how-to

@mrlubos
Copy link

mrlubos commented Jan 31, 2022

I got this

Generating JavaScript bundles failed at .cache/loader.js 

/usr/src/app/www/.cache/loader.js: Missing class properties transform.
107 |   }
  108 |
> 109 |   inFlightNetworkRequests = new Map()
      |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  110 |
  111 |   memoizedGet(url) {
  112 |     let inFlightPromise = this.inFlightNetworkRequests.get(url)

For more details see https://gatsby.dev/issue-how-to

Did you try the workaround?

@MoatazAbdAlmageed
Copy link

I got this

Generating JavaScript bundles failed at .cache/loader.js 

/usr/src/app/www/.cache/loader.js: Missing class properties transform.
107 |   }
  108 |
> 109 |   inFlightNetworkRequests = new Map()
      |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  110 |
  111 |   memoizedGet(url) {
  112 |     let inFlightPromise = this.inFlightNetworkRequests.get(url)

For more details see https://gatsby.dev/issue-how-to

Did you try the workaround?

I will and let you know, Thanks.

@MoatazAbdAlmageed
Copy link

I did the workaround but I didn't found any canges in git ?!

@MoatazAbdAlmageed
Copy link

image

@MoatazAbdAlmageed
Copy link

{
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }]
  ],
  "presets": [
    [
      "babel-preset-gatsby",
      {
        "targets": {
          "browsers": [">0.25%", "not dead"]
        }
      }
    ]
  ]
}

thanks works for me

@fzyzcjy
Copy link

fzyzcjy commented Feb 4, 2022

rm -rf yarn.lock node_modules && yarn

works for me, thanks!

@altano
Copy link

altano commented Feb 28, 2022

I had to remove node_modules in addition to the package-lock.json:

rm -rf node_modules && rm package-lock.json && npm i

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.