L
L
lolrofl012018-07-26 15:54:09
Web development
lolrofl01, 2018-07-26 15:54:09

How to properly include js libraries in laravel mix?

I am a beginner but trying to learn, so please give an understanding of how the following works.
I use laravel mix to merge and minify js/css files. Now there is a need to add the js library using yarn. The library has been added to node_modules. As I understand it, I should somehow just connect it to the main js file, and then somehow webpack will also minify it and add it to the frontend. Actually, I don’t know these two things:
1) How to connect this library to my js file
2) How to force webpack (and I work with a laravel mix wrapper on it) to minify this file and add it to the same 1 js file for the frontend?
Thank you for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2018-07-26
@Fragster

let instance = require('libraryname');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question