Registry / gcp / webpack-google-cloud-storage-plugin

webpack-google-cloud-storage-plugin

JSON →
library0.9.0jsnpmunverified

A Webpack plugin to upload assets to Google Cloud Storage. Current stable version is 0.9.0. It integrates with Webpack's compilation process to automatically upload specified files after each build. Supports configurable file inclusion/exclusion via regex patterns, custom destination paths, metadata, gzip compression, public access, and resumable uploads. Designed for production deployment workflows. Requires Google Cloud Storage credentials. Release cadence is infrequent; last release was on an unspecified date.

npm install webpack-google-cloud-storage-plugin
INSTALL
IMPORT
SIG · WEBPACK-GOOGLE-CLO
W
webpack-google-cloud-storage-plugin
gcpjavascriptv0.9.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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
musl
node 18–226 runs
build_error
glibc
node 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, }, }), ], };
Debug
Known issues
deprecatedstorageOptions.keyFilename is misspelled as 'keyFilename' but in older versions the option was 'keyFileName' (with double 'n').
fix
Use 'keyFilename' (single 'n') as per documentation.
affects: 0.8.x
breakingIn version 0.8.0, the plugin stopped supporting obsolete options that were previously deprecated.
fix
Update to 0.8.0+ and remove any deprecated options.
affects: <0.8.0
gotchaThe plugin requires @google-cloud/storage as a peer dependency, not automatically installed.
fix
Run 'npm install --save @google-cloud/storage'.
affects: >=0.8.0
gotchaCommonJS require returns the default export directly, not an object with default property in newer versions.
fix
Use 'require('...').default' or switch to ES import.
affects: >=0.9.0
breakingWebpack 4+ requires the plugin to be instantiated with 'new' and passed to plugins array, not as a function.
fix
Ensure you use 'new' keyword.
affects: >=0.8.0
Errors
Common errors & fixes
Error: Cannot find module '@google-cloud/storage'
@google-cloud/storage is not installed or missing as a dependency.
fix
Install 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).
fix
Use: 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.
fix
Check 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.
fix
Verify the bucket name and ensure it exists in the correct project.
Upgrade
Version history
0.9.0latest on npm
Audit
Dependencies
@google-cloud/storagerequiredProvides the actual Google Cloud Storage client for uploading files
webpackrequiredThe plugin is designed to work with Webpack 2+
Agent activity
32 hits · last 30 days
node
24
OpenAI (training)
1
Resources
webpack-google-cloud-storage-plugin — npm install webpack-google-cloud-storage-plugin · libregistry