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

Optimizer should replace all usages of $() error (may not be qwik dev astro integration) #171

Open
Shane-Donlon opened this issue Nov 30, 2024 · 0 comments

Comments

@Shane-Donlon
Copy link

I just came across this error yesterday and thought I'd log an issue, it is a really specific set of instructions, and may NOT be related to Qwik Astro and could be related to the Netlify adapter.

My logic was that I was testing something and knew I would deploy to Netlify so at the start decided to install the adapter before coding anything.

in terminal run npm create astro@latest

Output

astro Launch sequence initiated.

dir Where should we create your new project?
./netlify-testing-astro-qwik

tmpl How would you like to start your new project?
Include sample files

ts   Do you plan to write TypeScript?
     Yes

use How strict should TypeScript be?
Strict

deps Install dependencies?
Yes

git Initialize a new git repository?
No
◼ Sounds good! You can always run git init manually.

  ✔  Project initialized!
     ■ Template copied
     ■ TypeScript customized
     ■ Dependencies installed

next Liftoff confirmed. Explore your project!

     Enter your project directory using cd ./netlify-testing-astro-qwik
     Run npm run dev to start the dev server. CTRL+C to stop.
     Add frameworks like react or tailwind using astro add.

Close terminal open project in VSCode

Run npx astro add @qwikdev/Astro in Vscode terminal


Output

npx astro add @qwikdev/astro
✔ Resolving packages...

Astro will run the following command:
If you skip this step, you can always run it yourself later

╭───────────────────────────────────────────────────────────────────────────────╮
│ npm install @qwikdev/astro@^0.6.3 @builder.io/qwik@^1.11.0 typescript@^5.7.2 │
╰───────────────────────────────────────────────────────────────────────────────╯

√ Continue? ... yes
✔ Installing dependencies...

Astro will make the following changes to your config file:

╭ astro.config.mjs ─────────────────────────────╮
│ // @ts-check
│ // @ts-check
│ import { defineConfig } from 'astro/config'; │
│ │
│ import qwikdev from '@qwikdev/astro'; │
│ │
│ // https://astro.build/config
│ export default defineConfig({ │
│ integrations: [qwikdev()] │
│ }); │
╰───────────────────────────────────────────────╯

√ Continue? ... yes

success Added the following integration to your project:

  • @qwikdev/astro

npx astro add netlify
npx astro add netlify
✔ Resolving packages...

Astro will run the following command:
If you skip this step, you can always run it yourself later

╭──────────────────────────────────────╮
│ npm install @astrojs/netlify@^5.5.4 │
╰──────────────────────────────────────╯

√ Continue? ... yes
✔ Installing dependencies...

Astro will make the following changes to your config file:

╭ astro.config.mjs ─────────────────────────────╮
│ // @ts-check
│ // @ts-check
│ import { defineConfig } from 'astro/config'; │
│ │
│ import qwikdev from '@qwikdev/astro'; │
│ │
│ import netlify from '@astrojs/netlify'; │
│ │
│ // https://astro.build/config
│ export default defineConfig({ │
│ integrations: [qwikdev()], │
│ output: 'server', │
│ adapter: netlify() │
│ }); │
╰───────────────────────────────────────────────╯

For complete deployment options, visit
https://docs.astro.build/en/guides/deploy/

√ Continue? ... yes

success Added the following integration to your project:

  • @astrojs/netlify

update tsconfig

,"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@builder.io/qwik"
}

Run dev server here

Create counter component in Components/Counter.jsx

import { component$ } from "@builder.io/qwik";

export const Counter = component$(() => {
  return (
    <>
      <button type="button">testing</button>
    </>
  );
});



add to index.astro file
import { Counter } from "../components/Counter";


Error
An error occurred.
Optimizer should replace all usages of $() with some special syntax. If you need to create a QRL manually, use inlinedQrl() instead.
dist/core.mjs:8943:15
Open in editor
Stack Trace
Error: Optimizer should replace all usages of $() with some special syntax. If you need to create a QRL manually, use inlinedQrl() instead.

Cannot fix this error

To fix
Go to astro.config.mjs and press ctrl+s
Server will relod and solve error

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

1 participant