prismicio / slice-machine

A series of tools for developing and deploying website sections with Prismic
https://prismic.io/docs
Apache License 2.0
287 stars 53 forks source link

[adapter-next] Generate `prismicio.js` in `src` directory if the project uses `src` #947

Closed angeloashmore closed 1 year ago

angeloashmore commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently, @slicemachine/adapter-next generates a prismicio.js file at the root of the project. If a project is set up with Next.js' recommended @/* alias (see the --import-alias option in create-next-app), the file can be imported anywhere in the project using @/prismicio.

However, if a project also uses the recommended src directory, the @/prismicio import no longer works. The alias is mapped to ./src, which does not contain the generated prismicio.js file.

Describe the solution you'd like

Generate the prismicio.js file at src/prismicio.js if the project contains a src directory.

@slicemachine/adapter-next already does something similar when generating the slice-simulator.js file. See this excerpt.

Describe alternatives you've considered

Additional context

None

Ali-Parandeh commented 1 year ago

+1

angeloashmore commented 1 year ago

This was completed in https://github.com/prismicio/slice-machine/pull/1017