I'm trying to import a JSON-file which is in our .gitignore using something like await import("i18n/en.json") in getStaticProps. (Or just import on the top, which doesn't work neither).
Context: We use this to import and provide an auto-generated locale file to be used by Rosetta for i18n. This file is auto generated on build or during development and shouldn't go into git, usually.
Create a JSON-file somewhere, e.g. the public dir.
Add it to your local .gitignore file.
Import it in a Next.js page, statically or dynamically.
Boom π₯
Workaround 1
Remove the file from your .gitignore
Hooray π
Workaround 2
If you happen to be in a monorepo like we are, add it to a .gitignore above your Blitz folder
Hooray π
Run blitz -v and paste the output here:
macOS Big Sur | darwin-x64 | Node: v14.17.5
blitz: 0.39.0 (local)
Package manager: npm
System:
OS: macOS 11.5.2
CPU: (8) x64 Apple M1
Memory: 126.57 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.5 - /var/folders/0t/qf92ltfx37jblv7t_3_7v8mh0000gn/T/yarn--1629305144503-0.03753126972524701/node
Yarn: 1.22.11 - /var/folders/0t/qf92ltfx37jblv7t_3_7v8mh0000gn/T/yarn--1629305144503-0.03753126972524701/yarn
npm: 6.14.14 - /var/folders/0t/qf92ltfx37jblv7t_3_7v8mh0000gn/T/fnm_multishells/77055_1629103506935/bin/npm
Watchman: Not Found
npmPackages:
@prisma/client: Not Found
blitz: Not Found
prisma: Not Found
react: Not Found
react-dom: Not Found
typescript: Not Found
Please include below any other applicable logs and screenshots that show your problem:
What is the problem?
I'm trying to import a JSON-file which is in our
.gitignore
using something likeawait import("i18n/en.json")
ingetStaticProps
. (Or justimport
on the top, which doesn't work neither).Context: We use this to import and provide an auto-generated locale file to be used by Rosetta for i18n. This file is auto generated on build or during development and shouldn't go into git, usually.
Paste all your error logs here:
Paste all relevant code snippets here:
What are detailed steps to reproduce this?
public
dir..gitignore
file.Workaround 1
.gitignore
Workaround 2
.gitignore
above your Blitz folderRun
blitz -v
and paste the output here:Please include below any other applicable logs and screenshots that show your problem:
No response