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

importSync error: Expected identifier but found "*" when using the @cached decorator in ember-headless-table with @embroider/vite #1851

Closed
johanrd opened this issue Mar 21, 2024 · 1 comment

Comments

@johanrd
Copy link
Contributor

johanrd commented Mar 21, 2024

@mansona thanks for an exciting demo today during the Ember.js Europe meetup🚀 I tried the steps tonight on my own app, and it turns out I belong to the 40% that wouldn't get vite to run with ember-source 5.7.0:)

Since ember-headless-table is a V2 addon that works well in webpack, I am posting it as an issue here, and not on the addon repo.

Steps to reproduce:

  1. Checkout the ember-headless-table-expected-identifier-on-cached-decorator branch in this repository: https://github.com/johanrd/ember-vite-app
  2. Run pnpm vite
  3. See the following error in the console:
✘ [ERROR] Expected identifier but found "*"

    node_modules/.pnpm/ember-headless-table@2.1.4_@babel+core@7.24.3_@ember+test-helpers@3.3.0_@ember+test-waiters@3_iveooflb4fr3ajv754gzshjrpu/node_modules/ember-headless-table/dist/table-443deac1.js:3:18:
      3 │ import { tracked, * as _importSync0 } from '@glimmer/tracking';
        ╵                   ^

~/ember-vite-app/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1651
  let error = new Error(text);
              ^

Error: Build failed with 1 error:
node_modules/.pnpm/ember-headless-table@2.1.4_@babel+core@7.24.3_@ember+test-helpers@3.3.0_@ember+test-waiters@3_iveooflb4fr3ajv754gzshjrpu/node_modules/ember-headless-table/dist/table-443deac1.js:3:18: ERROR: Expected identifier but found "*"
    at failureErrorWithLog (~/ember-vite-app/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1651:15)
    at ~/ember-vite-app/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1059:25
    at ~/ember-vite-app/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1527:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

The compiled V2 output of the addon seems to include an importSync reference to @glimmer/tracking and ember-cached-decorator-polyfill:

let cached = macroCondition(dependencySatisfies('ember-source', '>= 4.1.0-alpha.0')) ? importSync('@glimmer/tracking').cached : importSync('ember-cached-decorator-polyfill').cached;

Perhaps the use of ember-cached-decorator-polyfill is the issue here? not sure. Possibly also related to #1672?

@patricklx
Copy link
Contributor

Oh, that's exactly what i saw today as well. A fix is being worked on here
ef4/babel-import-util#11

@johanrd johanrd closed this as completed May 16, 2024
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