I'm working with an application that uses a custom builder to inject scripts into the head of the DOM. In this particular case, I need to reference a JS file that exists in an installed library from the webpack config of the main application.
The best solution I can come up with is to reference it like this in the app.config.js file but it seems a bit clunky. Is it possible to get the path to this file in a cleaner way?
{
name: 'loader-thing',
placement: 'HEAD',
filename: path.resolve(__dirname, 'node_modules/my-package/src/assets/loader_static.js'),
},
The builder reads the file at this path and then injects it into the head...that probably needs some attention as well but for now I'd just like to know that my approach isn't stupid.