Skip to content

Should pnpm also install react-router-dom explicitly? #4

@DaveParr

Description

@DaveParr

I was working through the frontend blog and wondered if the command for pnpm was missing react-router-dom?
Currently:

Developing the UI
Install react-router-dom, react-query and axios
$ pnpm install react-query axios

and then pnpm build, I got:

❯ pnpm build

> [email protected] build /home/dave/Development/test_loco_saas/vite-project
> vite build

vite v5.0.10 building for production...
✓ 3 modules transformed.
[vite]: Rollup failed to resolve import "react-router-dom" from "/home/dave/Development/test_loco_saas/vite-project/src/main.jsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "react-router-dom" from "/home/dave/Development/test_loco_saas/vite-project/src/main.jsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:66953:27)
    at onwarn (file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vitejs/plugin-react/dist/index.mjs:250:9)
    at onRollupWarning (file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:66978:9)
    at onwarn (file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:66698:13)
    at file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17367:13
    at Object.logger [as onLog] (file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19025:9)
    at ModuleLoader.handleInvalidResolvedId (file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17971:26)
    at file:///home/dave/Development/test_loco_saas/vite-project/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17929:26
 ELIFECYCLE  Command failed with exit code 1.
 


 Subsequently running: pnpm install react-query axios react-router-dom and then pnpm build got a successful outcome with the expected UI and functionality.

 Hope this helps/ makes sense :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions