Cannot find module after install devDependency #1135
-
I just install this library in my After import import { faker } from '@faker-js/faker'; my app crash and display the following error: Error: Cannot find module "/node_modules/@faker-js/faker/dist/cjs/index.js". Try installing the npm package or make sure it is not a devDependency. Should I install Dependency instead? |
Beta Was this translation helpful? Give feedback.
Answered by
Shinigami92
Jul 8, 2022
Replies: 1 comment
-
Yes, seems you want to use Faker not for e.g. mocking test data or so You should think about using it like so: import { faker } from '@faker-js/faker/locale/en'; Because this will reduce bundle size from ~4 MiB to ~600 KiB |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
yuniit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, seems you want to use Faker not for e.g. mocking test data or so
So if you want to use Faker in production bundled code, sure you need to install it as dependency directly
You should think about using it like so:
Because this will reduce bundle size from ~4 MiB to ~600 KiB