-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Parcel reports a missing dependency while building a site with i18nextify #91
Comments
I'm not familiar with parcel... but cross-fetch is a dependency of i18next-http-backend (https://github.com/i18next/i18next-http-backend/blob/master/package.json#L25) and i18next-http-backend is a dependency of i18nextify (https://github.com/i18next/i18nextify/blob/master/package.json)... |
Interesting. So what you're suggesting is, the problem is with the resolver. |
btw: why are you not importing i18nextify (or i18next) directly in your js code instead of using the script tag? import i18nextify from "i18nextify";
i18nextify.init({debug: true}) |
I'm completely new to using i18next, and that was simply the first thing described in the guide. I'm not sure how exactly does i18next work when added to a script, and how should I pass arguments to it. Still poking around. However, I've tried to import it as you suggest, and strangely enough, now the build ends just fine. What gives? |
I think, then you better use i18next directly... (no script tag)... |
Thanks, I've already watched it. The problem is, it shows some pretty in-depth things from the get-go - like interpolation or pluralization, which I don't need now (and chances are, won't need at all in this project). My site is merely a static landing which doesn't use any frameworks, but I needed JSONs for translation, so I immediately latched onto the idea :) I'm not sure what backend portion of i18next does. Is it there only to auto-add missing keys to the translation files? Since my site is entirely static, I have no backend, so I'm kinda confused here. It does resemble the stack of middlewares for Express tho... (also, while I appreciate the help, I feel like I'm deviating from the topic ) |
For static website i18nextify is the perfect package... |
🐛 Bug Report
I am building a static site with Parcel as bundler. It uses its own development server to serve and hot-reload pages.
I've added
<script src="/node_modules/i18nextify/i18nextify.min.js" type="module" id="i18nextify" fallbacklng="en"></script>
in
<head>
of my html file and created a translation.json, so i18nextify properly runs with?debug=true
.However, building the site fails, as Parcel points out that the dependency "cross-fetch" that i18nextify uses is missing in its package.json :
To Reproduce
npm i i18nextify
)What I'm doing here is processing all html files via parcel as well as any files in locales/*/ path - i.e. all the i18nextify translation files. My main file to serve is
/src/index.html
4. Add i18nextify in the head of
/src/index.html
as the guide suggests:.parcelrc
in root directory of the project needs another option to skip bundling JSONs and copy them verbatim, so it should look like this in the end:npm run dev
, Parcel serves the page with i18nextify working in it (with?debug=true
, of course). However, tryingnpm run build
triggers this error.Expected behavior
I expect the production version to be built and work just like the dev one does.
Your Environment
The text was updated successfully, but these errors were encountered: