The current version (2.1.31) of the cssuseragent package does not export anything other than a variable named cssua. I need to import/require this variable into my project using webpack.
I attempted to add the export keyword before the cssua variable, and it did work. However, this solution is not ideal because anyone else who upgrades the package in the future might not know that they need to do this.
When using the CLI:
npm i cssuseragent
I added the export statement to the cssua variable:
// 'export' was not present, so I added it
export var cssua = (
//some code here
)(/*some arguments here*/)
After doing this, I can now import the variable as follows:
import { cssua } from 'cssuseragent';
Is there a way to instruct webpack to rename the imported file as 'custom-name' along with all its content without modifying the source code of the third-party module? Changing the source code directly may not be feasible every time, especially for large modules. I am looking for a more generic approach, perhaps just by specifying the module's path.