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

astro build exits early without an error message with collections + MDX + top-level await #5628

Closed
1 task
andersk opened this issue Dec 18, 2022 · 6 comments
Closed
1 task
Assignees
Labels
- P2: has workaround Bug, but has workaround (priority) needs repro Issue needs a reproduction

Comments

@andersk
Copy link
Contributor

andersk commented Dec 18, 2022

What version of astro are you using?

1.7.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

In this project (minimized from #5619), astro build exits early without an error message.

astro.config.mjs

import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";

export default defineConfig({
  experimental: {
    contentCollections: true,
  },
  integrations: [mdx()],
});

src/content/blog/foo.mdx

foo

src/pages/test.txt.js

import { getCollection } from "astro:content";

await getCollection("blog");

export const get = () => ({ body: "test" });

Output

$ astro build
05:20:27 PM [build] output target: static
05:20:27 PM [build] Collecting build info...
05:20:27 PM [build] Completed in 365ms.
05:20:27 PM [build] Building static entrypoints...
05:20:27 PM [content] Types generated
05:20:28 PM [build] Completed in 0.78s.

 generating static routes 
$

There is no error message and no “Complete!” message. The expected output dist/test.txt is missing:

$ ls dist/
chunks  entry.mjs

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-6jktqr

Run astro build.

Participation

  • I am willing to submit a pull request for this issue.
@bluwy
Copy link
Member

bluwy commented Dec 18, 2022

Perhaps it's the same issue as #5318

@pilcrowonpaper
Copy link
Contributor

Seems to be an issue with import.meta.glob() and/or Astro.glob() #5629

@bholmesdev bholmesdev added the - P2: has workaround Bug, but has workaround (priority) label Dec 27, 2022
@Princesseuh
Copy link
Member

For context, this still seems to happens despite #5629 being fixed!

@surjithctly
Copy link

Same issue here. It works when I remove *.mdx file out of the content folder.

@bholmesdev
Copy link
Contributor

Just upgraded that minimal repro to the latest Astro and @astrojs/mdx packages. Looks like it runs successfully now! I'll let @andersk and/or @surjithctly confirm before marking as closed.

@bholmesdev bholmesdev added the needs repro Issue needs a reproduction label Mar 13, 2023
@andersk
Copy link
Contributor Author

andersk commented Mar 16, 2023

Seems to be working for me.

@andersk andersk closed this as completed Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: has workaround Bug, but has workaround (priority) needs repro Issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

7 participants