'googleapis not working with laravel mix when added in app.js in laravel

I uploaded a file using command node test.js in google drive and it worked perfectly. But now I am trying to upload a file when user selects a file. For that I added
const {google} = require('googleapis');
in /resources/js/app.js and ran a command npm run dev. but node is not able to compile and giving this error.

enter image description here enter image description here

resources/js/app.js

require('./bootstrap');

import Alpine from 'alpinejs';

window.Alpine = Alpine;
Alpine.start();
const {google} = require('googleapis');

webpack.mix.js

const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel applications. By default, we are compiling the CSS
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js', ).postCss('resources/css/app.css', 'public/css', [
    require('postcss-import'),
    require('tailwindcss'),
    require('autoprefixer'),
]);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source