In laravel mix, how do I reuse jquery import without creating multiple big js files? #36128
Unanswered
ProteanCode
asked this question in
Q&A
Replies: 2 comments
-
Okay so I see that jquery got registered in window object, so can I depend on the order of chain calls in webpack.mix.js to know if jQuery is present at specific file further down in compilation process? |
Beta Was this translation helpful? Give feedback.
0 replies
-
try this: mix.webpackConfig({
'externals': {
jquery: 'jQuery'
}
}); reference: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an app.js file that imports bootstraps (require('bootstrap')), and this is fine. I use this file in my layout, but I need to use jQuery in one another page.
If I want to create a registration.js file where I do import jQuery (import * as $ from "jquery") I noticed that the output file is quite big. I want to reuse the jquery from previously required bootstrap.js
Beta Was this translation helpful? Give feedback.
All reactions