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

🐛 BUG(S): Internal not defined in exports, projectRootStr errors in new URL, Cannot read properties of undefined (reading 'createAstro') #507

Closed
reggi opened this issue Aug 31, 2022 · 3 comments
Labels
needs triage Issue needs to be triaged

Comments

@reggi
Copy link

reggi commented Aug 31, 2022

What version of @astrojs/compiler are you using?

^0.23.4

What package manager are you using?

npm

What operating system are you using?

mac

Describe the Bug

Demo here: https://github.com/reggi/astro-compiler-issues

I hit a bunch of issues trying a simple example to get this up and running, perhaps I did it wrong?

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './internal' is not defined by "exports" in /Users/thomasreggi/Desktop/astro-compiler/node_modules/astro/package.json imported from /Users/thomasreggi/Desktop/astro-compiler/example.mjs
    "./internal": "./dist/runtime/server/index.js",

and:

file:///Users/thomasreggi/Desktop/astro-compiler/node_modules/astro/dist/runtime/server/astro-global.js:20
  const projectRoot = new Url(projectRootStr);
                      ^

ReferenceError: Url is not defined
    at createAstro (file:///Users/thomasreggi/Desktop/astro-compiler/node_modules/astro/dist/runtime/server/astro-global.js:20:23)
    at file:///Users/thomasreggi/Desktop/astro-compiler/example.mjs:22:17
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

The project root:

{ projectRootStr: '.' }

is being passed into const projectRoot = new URL(projectRootStr);

in this file

node_modules/astro/dist/runtime/server/astro-global.js

Then I fixed that by changing it to const projectRoot = projectRootStr

But now the generated code doesn't work:

const Astro = $$result.createAstro($$Astro, $$props, $$slots);
                       ^

TypeError: Cannot read properties of undefined (reading 'createAstro')

Link to Minimal Reproducible Example

https://github.com/reggi/astro-compiler-issues

@reggi reggi changed the title 🐛 BUG: 🐛 BUG: Internal not defined in exports, projectRootStr errors in new URL, Cannot read properties of undefined (reading 'createAstro') Aug 31, 2022
@reggi reggi changed the title 🐛 BUG: Internal not defined in exports, projectRootStr errors in new URL, Cannot read properties of undefined (reading 'createAstro') 🐛 BUG(S): Internal not defined in exports, projectRootStr errors in new URL, Cannot read properties of undefined (reading 'createAstro') Aug 31, 2022
@rv-uhimely
Copy link

@reggi Were you ever able to solve this issue?

@reggi
Copy link
Author

reggi commented Oct 29, 2022

@rv-uhimely i was never able to get the astro compiler work, but I haven't tried in a bit, there wasn't much docs at the time.

@Princesseuh Princesseuh added the needs triage Issue needs to be triaged label Nov 12, 2023
@MoustaphaDev
Copy link
Member

Hello @reggi 👋
I'm not sure what you're trying to do but I could get it to work in compiler v2.3.4 and astro 4.0.6.
https://stackblitz.com/edit/github-e8qcpy?file=compiler.mjs,useage.mjs

I'm gonna close this for now, feel free to reopen if you still have the issue.

@MoustaphaDev MoustaphaDev closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

4 participants