universal-ember / reactiveweb

Reactive primitives for the web
https://reactive.nullvoxpopuli.com
MIT License
11 stars 5 forks source link

Error Static class blocks are not enabled #104

Closed basz closed 5 months ago

basz commented 5 months ago

While upgrading to ember-resources v7 and adding reactiveweb for import { trackedFunction } from 'reactiveweb/function'; I'm getting an error

ERROR in ../../../node_modules/.pnpm/reactiveweb@1.3.0_@babel+core@7.24.7_@ember+test-waiters@3.1.0_@glimmer+component@1.1.2_@glim_yrkfjzx3c37f6sxd65qf4rr6ui/node_modules/reactiveweb/dist/function.js
Module build failed (from ../../../node_modules/.pnpm/babel-loader@8.3.0_@babel+core@7.23.9_webpack@5.91.0/node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/reactiveweb@1.3.0_@babel+core@7.24.7_@ember+test-waiters@3.1.0_@glimmer+component@1.1.2_@glim_yrkfjzx3c37f6sxd65qf4rr6ui/node_modules/reactiveweb/dist/function.js: Static class blocks are not enabled. Please add `@babel/plugin-transform-class-static-block` to your configuration.
  37 |  * State container that represents the asynchrony of a `trackedFunction`
  38 |  */
> 39 | class State {
     | ^
  40 |   static {
  41 |     g(this.prototype, "data", [tracked], function () {
  42 |       return null;
    at File.buildCodeFrameError (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+core@7.23.9/node_modules/@babel/core/lib/transformation/file/file.js:205:12)
    at NodePath.buildCodeFrameError (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/path/index.js:98:21)
    at shouldTransform (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+helper-create-class-features-plugin@7.24.6_@babel+core@7.23.9/node_modules/@babel/helper-create-class-features-plugin/lib/features.js:136:16)
    at PluginPass.Class (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+helper-create-class-features-plugin@7.24.6_@babel+core@7.23.9/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:114:44)
    at newFn (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/visitors.js:160:14)
    at NodePath._call (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/path/context.js:82:31)
    at TraversalContext.visitQueue (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/context.js:89:16)
    at TraversalContext.visitMultiple (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/context.js:61:17)
    at TraversalContext.visit (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/context.js:110:19)
    at traverseNode (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/traverse-node.js:22:17)
    at NodePath.visit (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/path/context.js:88:52)
    at TraversalContext.visitQueue (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/context.js:89:16)
    at TraversalContext.visitSingle (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/context.js:65:19)
    at TraversalContext.visit (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/context.js:112:19)
    at traverseNode (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/traverse-node.js:22:17)
    at traverse (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+traverse@7.24.5/node_modules/@babel/traverse/lib/index.js:52:34)
    at transformFile (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+core@7.23.9/node_modules/@babel/core/lib/transformation/index.js:82:31)
    at transformFile.next (<anonymous>)
    at run (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+core@7.23.9/node_modules/@babel/core/lib/transformation/index.js:24:12)
    at run.next (<anonymous>)
    at transform (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/@babel+core@7.23.9/node_modules/@babel/core/lib/transform.js:22:33)
    at transform.next (<anonymous>)
    at step (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:261:32)
    at /Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/bas/Documents/Projects/PLHW.ProjectHealthyFeet/applications/hf-app-lab/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:223:11)
 @ ../../../../../../../../../../private/var/folders/xv/1hrp6hhj4qz58n_611_772zr0000gn/T/broccoli-93141luj01NFwJ7Hs/cache-1141-webpack_bundler_ember_auto_import_webpack/app.cjs 160:100-131

I've added '@babel/plugin-transform-class-static-block as dependency and modified ember-cli-build.js to include

babel: {
      plugins: [require.resolve('@babel/plugin-transform-class-static-block')],
    },

I've also update embroider, webpack and babel + plugin to latest. What could this be?

NullVoxPopuli commented 5 months ago

your app should upgrade to ember-cli-babel @ 8.2.0+

basz commented 5 months ago

i am at 8.2.0

NullVoxPopuli commented 5 months ago

are your embroider deps up to date as well?

also, if you want synchronously debug, you can tag me on discord

NullVoxPopuli commented 5 months ago

Solution: also update ember-auto-import. 2.7+ is needed.

Readme has been updated to reflect this.