How to use JS Modules in metronic 8 laravel?
I've faced this issue so many times that it became annoying at this point.
When I add NPM package like the doc is mentioning and run laravel mix, it bundles the package and works. However!!!
I can't follow the package documentation and code examples due to the following errors I'm getting. When I create a new JS file named 'Pintura-options.js' within public/demo8/plugins/custom/FilePond/Pintura-options.js
and try to use
import something from @something
When I try to use that same code within the blade file itself under I get another error.
I tried adding code in a separate JS file, withing a script tag, and within the master template...I couldn't get the code to work.. I reached a point where I started a new fresh project without Metronic just to check and the code worked as expected.
I just want to know, how can I use JS modules? where do I place the files? I'm completely lost. When I read package's docs I always ditch the module bundlers and focus on CDNs instead and I am sure that's a very bad idea for Metronic rules.
Kindly help,
Thank you
Replies (1)
Hi,
Sorry for the delay. Could you please separate your custom plugin into another folder? Not in the folder plugins/custom
.
Then update the webpack.mix.js to include your custom js file.
https://laravel-mix.com/docs/main/mixjs
Thanks