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

laravel mix/webpack ERROR Module not found: Error: Can't resolve 'jquery' #553

Open
jayenne opened this issue Jan 22, 2021 · 2 comments
Open

Comments

@jayenne
Copy link

jayenne commented Jan 22, 2021

Hi,
I'm using a clean Laravel install and using Packery with vanilla Javascript (sans Jquery).
It works perfectly using a cdn include but when I replace that script with an NPM require if fails:

ERROR in ./node_modules/packery/dist/packery.pkgd.min.js Module not found: Error: Can't resolve 'jquery' in '/var/www/jetstream/node_modules/packery/dist'

I simply install via NPM
then add mix.js('node_modules/packery/dist/packery.pkgd.min.js','public/js') to my webpack.mix.js
When I npm run dev it fails with the error above.

Is this to be expected?
Do I really need jQuery for it to compile?

Thanks.

@desandro
Copy link
Member

You do not need jQuery to compile. The issue is likely that package.pkgd.min.js includes jquery-bridget which does require jQuery. Instead, I recommend you require the source file node_modules/packery/js/packery, rather than the dist file.

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

No branches or pull requests

2 participants