I'm currently facing an issue with importing a single function into my Vue component. To tackle this problem, I separated the function into its own js file:
randomId.js:
exports.randomId = () => //My function ...
Within my Vue component, I attempted to import the Random js:
let randomId = require('../functions/randomId');
randomId();
However, upon doing so, Webpack throws an error stating "randomId is not a function". I also tried importing the file using the import syntax, but encountered the same error.
import randomId from '../functions/randomId';
Any suggestions on alternative methods for importing single functions? As a newcomer to both Webpack and JS6, any advice would be greatly appreciated.