inveniosoftware / inveniosoftware/react-searchkit
npm start fails on a fresh clone: @translations/i18next cannot be resolved by webpack
- Dominant language
- JavaScript
- Stars
- 83
- Forks
- 48
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 4
Description
Package version (if known): master (v3.2.0)
## Describe the bug
`npm start` fails to compile on a fresh clone. Ten components that import
`@translations/i18next` fail with:
Module not found: Error: Can't resolve '@translations/i18next'
Affected: AutocompleteSearchBar, EmptyResults, Error, RangeCustomFilter,
RangeFacet, ResultsPerPage, SearchBar, SortBy, SortOrder, Sort.
The `@translations/i18next` alias is defined for Jest (`jest.moduleNameMapper`
in package.json) and for the library build (`@rollup/plugin-alias` in
rollup.config.js), but nothing provides it to webpack, which is what
`react-scripts start` uses. So tests and `npm run build` pass while only the
demo dev server is broken, which may be why this hasn't surfaced.
I confirmed the cause by adding a local shim in node_modules mapping the alias
to `src/lib/i18next`. After that `npm start` compiles and the demos render.
## Steps to Reproduce
1. git clone https://github.com/inveniosoftware/react-searchkit.git
2. npm install
3. npm start
## Expected behavior
`npm start` compiles and serves the demo apps.
## Additional context
Node 24.11.1, Windows 11.
CRA doesn't allow custom webpack aliases without ejecting, so the fix likely
needs a maintainer decision (relative import in the demos, or a
jsconfig/craco setup). Happy to open a PR once there's a preferred direction.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with npm start, then compare the @translations/i18next mappings in package.json and rollup.config.js with the webpack path used by react-scripts. Review the affected components and src/lib/i18next before choosing between the relative-import and CRA configuration directions. Done means the demo apps compile and render from a fresh clone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, rollup, webpack
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100