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

fix: Specifies type of package as module #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DKFN
Copy link

@DKFN DKFN commented Jan 18, 2024

In the process of changing framework from Gatsby to Astro, I have stumbled on a build error while using React SSR with astro using this package.

22:57:28 [ERROR] Cannot use import statement outside a module
  Stack trace:
    at internalCompileFunction (node:internal/vm:73:18)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This change involves specifying the type of the package to module, wich seems to be the intended type.

Linking this package locally and setting a component using the prismicio to render with SSR works great, for example:

import {PrismicImage} from "@prismicio/react";

const serializer = {
    image: ({node}) => renderToString(<PrismicImage field={node} />)
}

It also keep working for clientside only rendered components.

Resolves: #193

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

Thanks for your time :)

Instead of an animal or car picture, here is a smiling EN57
image
Pic by MOs810 on Wikimedia

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

Successfully merging this pull request may close these issues.

Unable to import into an Astro application
1 participant