Skip to content
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

Error: [vite]: Rollup failed to resolve import "lodash" #124

Closed
1MuneebUrRehman opened this issue Mar 8, 2023 · 4 comments · Fixed by #126
Closed

Error: [vite]: Rollup failed to resolve import "lodash" #124

1MuneebUrRehman opened this issue Mar 8, 2023 · 4 comments · Fixed by #126

Comments

@1MuneebUrRehman
Copy link

While running "php artisan larastarters:install" command and selecting option 2, followed by option 0. During the build, Vite failed to resolve the import "lodash" from "C:/laragon/www/test/resources/js/bootstrap.js".

Laravel v10.3.2 (PHP v8.1.10)

Steps to Reproduce

  1. Run composer require laraveldaily/larastarters --dev command in your Laravel project.
  2. Run php artisan larastarters:install command.
  3. Select option 2, followed by option 0.

Error Traceback

Error: [vite]: Rollup failed to resolve import "lodash" from "C:/laragon/www/test/resources/js/bootstrap.js".
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 onRollupWarning (file:///C:/laragon/www/test/node_modules/vite/dist/node/chunks/dep-ca21228b.js:44792:19)
    at onwarn (file:///C:/laragon/www/test/node_modules/vite/dist/node/chunks/dep-ca21228b.js:44562:13)
    at Object.onwarn (file:///C:/laragon/www/test/node_modules/rollup/dist/es/shared/node-entry.js:24950:13)
    at ModuleLoader.handleInvalidResolvedId (file:///C:/laragon/www/test/node_modules/rollup/dist/es/shared/node-entry.js:23632:26)
    at file:///C:/laragon/www/test/node_modules/rollup/dist/es/shared/node-entry.js:23592:26

image

image

Solution

npm install lodash
npm install && npm run dev
@1MuneebUrRehman
Copy link
Author

@PovilasKorop Can you look into this? Thanks

@krekas
Copy link
Contributor

krekas commented Mar 8, 2023

This issue is related to this pr laravel/ui#247 could you make a pr with a fix?

@1MuneebUrRehman
Copy link
Author

1MuneebUrRehman commented Mar 8, 2023

Sure, I can help you with that!

I have tested the changes locally and they appear to resolve the issue.

@1MuneebUrRehman
Copy link
Author

Hi @krekas!

I've just submitted a pull request to address the issue #124 and I was wondering if you could take a look at it and provide me with some feedback. I'd really appreciate it!

The link to the pull request is here. Let me know if you have any questions or if there's anything else I can do to help. Thanks a lot for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants