@martinbean I understand that it is difficult to integrate fontawesome even just because they are complex files with images and fonts, so let's do the example with LightGallery(lightgalleryjs.com), I want to understand the logic how it works... I couldn't find any guides online.
Execution:
npm install lightgallery
So I have the files in:
node_modules\lightgallery\lightgallery.umd.js
node_modules\lightgallery\css\lightgallery-bundle.min.css
From what I understand then, I now have to integrate these into my webpack (looking at projects on github):
mix.postCss('resources/css/gallery.css', 'public/css', [
require("lightgallery")
]);
I'm doing something wrong, though, because I'm getting the error:
ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
ReferenceError: window is not defined
at C:\xampp\htdocs\LaraveLProject\node_modules\lightgallery\lightgallery.umd.js:163:13
at initLgPolyfills (C:\xampp\htdocs\LaraveLProject\node_modules\lightgallery\lightgallery.umd.js:176:11)
at $LG (C:\xampp\htdocs\LaraveLProject\node_modules\lightgallery\lightgallery.umd.js:532:9)
at new LightGallery (C:\xampp\htdocs\LaraveLProject\node_modules\lightgallery\lightgallery.umd.js:856:25)
at lightGallery (C:\xampp\htdocs\LaraveLProject\node_modules\lightgallery\lightgallery.umd.js:2727:16)
at LazyResult.runOnRoot (C:\xampp\htdocs\LaraveLProject\node_modules\postcss\lib\lazy-result.js:339:16)
at LazyResult.runAsync (C:\xampp\htdocs\LaraveLProject\node_modules\postcss\lib\lazy-result.js:393:26)
at LazyResult.async (C:\xampp\htdocs\LaraveLProject\node_modules\postcss\lib\lazy-result.js:221:30)
at LazyResult.then (C:\xampp\htdocs\LaraveLProject\node_modules\postcss\lib\lazy-result.js:206:17)
at processResult (C:\xampp\htdocs\LaraveLProject\node_modules\webpack\lib\NormalModule.js:758:19)
at C:\xampp\htdocs\LaraveLProject\node_modules\webpack\lib\NormalModule.js:860:5
at C:\xampp\htdocs\LaraveLProject\node_modules\loader-runner\lib\LoaderRunner.js:400:11
at C:\xampp\htdocs\LaraveLProject\node_modules\loader-runner\lib\LoaderRunner.js:252:18
at context.callback (C:\xampp\htdocs\LaraveLProject\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
at Object.loader (C:\xampp\htdocs\LaraveLProject\node_modules\postcss-loader\dist\index.js:142:7)
ERROR in /js/app
Module not found: Error: Can't resolve 'C:\xampp\htdocs\LaraveLProject\resources\css\gallery.css' in 'C:\xampp\htdocs\LaraveLProject'
I would like to learn how to manage npm packages...