Registry /
gcp / webpack-google-cloud-storage-plugin
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
WebpackGoogleCloudStoragePlugin
✓ import WebpackGoogleCloudStoragePlugin from 'webpack-google-cloud-storage-plugin'
✗ const { WebpackGoogleCloudStoragePlugin } = require('webpack-google-cloud-storage-plugin');
Default export only. CommonJS require returns the default export directly.
WebpackGoogleCloudStoragePlugin
✓ const WebpackGoogleCloudStoragePlugin = require('webpack-google-cloud-storage-plugin').default;
✗ const WebpackGoogleCloudStoragePlugin = require('webpack-google-cloud-storage-plugin');
In CommonJS, you need .default because it's an ES module default export.
WebpackGoogleCloudStoragePlugin
✓ import WebpackGoogleCloudStoragePlugin from 'webpack-google-cloud-storage-plugin';
✗ import { WebpackGoogleCloudStoragePlugin } from 'webpack-google-cloud-storage-plugin';
The plugin is a default export, not a named export.
Basic Webpack config using the Google Cloud Storage plugin with authentication via environment variables and file upload options.
const path = require('path');
const WebpackGoogleCloudStoragePlugin = require('webpack-google-cloud-storage-plugin').default;
module.exports = {
plugins: [
new WebpackGoogleCloudStoragePlugin({
directory: './dist',
include: ['app.js'],
exclude: [],
storageOptions: {
projectId: process.env.GCS_PROJECT_ID || 'my-project',
keyFilename: process.env.GCS_KEYFILE || './key.json',
},
uploadOptions: {
bucketName: 'my-bucket',
destinationNameFn: (file) => path.join('assets', file.path),
gzip: true,
makePublic: false,
resumable: true,
concurrency: 5,
},
}),
],
};
Errors
Common errors & fixes
Error: Cannot find module '@google-cloud/storage'
@google-cloud/storage is not installed or missing as a dependency.
fixInstall the peer dependency: npm install @google-cloud/storage
TypeError: WebpackGoogleCloudStoragePlugin is not a constructor
Plugin was not imported correctly (e.g., using named import instead of default).
fixUse: import WebpackGoogleCloudStoragePlugin from 'webpack-google-cloud-storage-plugin'
Error: ENOENT: no such file or directory, open '/path/to/keyfile.json'
The key file specified in storageOptions.keyFilename does not exist.
fixCheck the file path and ensure it exists, or use environment variables.
Error: The API returned an error: Error: The bucket 'my-bucket' does not exist
Bucket name in uploadOptions.bucketName does not exist in your GCP project.
fixVerify the bucket name and ensure it exists in the correct project.
Audit
Dependencies
@google-cloud/storagerequiredProvides the actual Google Cloud Storage client for uploading files
webpackrequiredThe plugin is designed to work with Webpack 2+