The Specifics
In our setup, we have integrated Laravel 5.3 with UIKit 2 using Elixir/webpack to bundle our JS files.
By default, Laravel comes with a /resources/js/bootstrap.js
file (not related to Twitter).
This file is utilized to include dependencies, with the current content being:
window._ = require('lodash');
window.$ = window.jQuery = require('jquery');
window.UI = window.UIkit = require('uikit');
However, since UIKit is component-based and allows for additional functionalities like modals/tooltips, you need to separately include these extra JS components.
These extra components are located at
/node_modules/uikit/dist/js/components/tooltip.js
Therefore, my current method involves the following:
window.UI = window.UIkit = require('uikit');
require('../../../node_modules/uikit/dist/js/components/tooltip');
You may notice the somewhat risky ../../../
at the beginning of the path which raises concerns about its stability in case the path changes.
The Query
Is there a more efficient and reliable approach to including these extra files? For instance:
require('uikit')->path('components/tooltip');
Thank you in advance