{"id":20773,"library":"webpack-google-cloud-storage-plugin","title":"Webpack Google Cloud Storage Plugin","description":"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.","status":"active","version":"0.9.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/syndbg/webpack-google-cloud-storage-plugin","tags":["javascript","assets","cloud","google","node","plugin","production","storage","upload"],"install":[{"cmd":"npm install webpack-google-cloud-storage-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-google-cloud-storage-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-google-cloud-storage-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the actual Google Cloud Storage client for uploading files","package":"@google-cloud/storage","optional":false},{"reason":"The plugin is designed to work with Webpack 2+","package":"webpack","optional":false}],"imports":[{"note":"Default export only. CommonJS require returns the default export directly.","wrong":"const { WebpackGoogleCloudStoragePlugin } = require('webpack-google-cloud-storage-plugin');","symbol":"WebpackGoogleCloudStoragePlugin","correct":"import WebpackGoogleCloudStoragePlugin from 'webpack-google-cloud-storage-plugin'"},{"note":"In CommonJS, you need .default because it's an ES module default export.","wrong":"const WebpackGoogleCloudStoragePlugin = require('webpack-google-cloud-storage-plugin');","symbol":"WebpackGoogleCloudStoragePlugin","correct":"const WebpackGoogleCloudStoragePlugin = require('webpack-google-cloud-storage-plugin').default;"},{"note":"The plugin is a default export, not a named export.","wrong":"import { WebpackGoogleCloudStoragePlugin } from 'webpack-google-cloud-storage-plugin';","symbol":"WebpackGoogleCloudStoragePlugin","correct":"import WebpackGoogleCloudStoragePlugin from 'webpack-google-cloud-storage-plugin';"}],"quickstart":{"code":"const path = require('path');\nconst WebpackGoogleCloudStoragePlugin = require('webpack-google-cloud-storage-plugin').default;\n\nmodule.exports = {\n  plugins: [\n    new WebpackGoogleCloudStoragePlugin({\n      directory: './dist',\n      include: ['app.js'],\n      exclude: [],\n      storageOptions: {\n        projectId: process.env.GCS_PROJECT_ID || 'my-project',\n        keyFilename: process.env.GCS_KEYFILE || './key.json',\n      },\n      uploadOptions: {\n        bucketName: 'my-bucket',\n        destinationNameFn: (file) => path.join('assets', file.path),\n        gzip: true,\n        makePublic: false,\n        resumable: true,\n        concurrency: 5,\n      },\n    }),\n  ],\n};","lang":"javascript","description":"Basic Webpack config using the Google Cloud Storage plugin with authentication via environment variables and file upload options."},"warnings":[{"fix":"Use 'keyFilename' (single 'n') as per documentation.","message":"storageOptions.keyFilename is misspelled as 'keyFilename' but in older versions the option was 'keyFileName' (with double 'n').","severity":"deprecated","affected_versions":"0.8.x"},{"fix":"Update to 0.8.0+ and remove any deprecated options.","message":"In version 0.8.0, the plugin stopped supporting obsolete options that were previously deprecated.","severity":"breaking","affected_versions":"<0.8.0"},{"fix":"Run 'npm install --save @google-cloud/storage'.","message":"The plugin requires @google-cloud/storage as a peer dependency, not automatically installed.","severity":"gotcha","affected_versions":">=0.8.0"},{"fix":"Use 'require('...').default' or switch to ES import.","message":"CommonJS require returns the default export directly, not an object with default property in newer versions.","severity":"gotcha","affected_versions":">=0.9.0"},{"fix":"Ensure you use 'new' keyword.","message":"Webpack 4+ requires the plugin to be instantiated with 'new' and passed to plugins array, not as a function.","severity":"breaking","affected_versions":">=0.8.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install the peer dependency: npm install @google-cloud/storage","cause":"@google-cloud/storage is not installed or missing as a dependency.","error":"Error: Cannot find module '@google-cloud/storage'"},{"fix":"Use: import WebpackGoogleCloudStoragePlugin from 'webpack-google-cloud-storage-plugin'","cause":"Plugin was not imported correctly (e.g., using named import instead of default).","error":"TypeError: WebpackGoogleCloudStoragePlugin is not a constructor"},{"fix":"Check the file path and ensure it exists, or use environment variables.","cause":"The key file specified in storageOptions.keyFilename does not exist.","error":"Error: ENOENT: no such file or directory, open '/path/to/keyfile.json'"},{"fix":"Verify the bucket name and ensure it exists in the correct project.","cause":"Bucket name in uploadOptions.bucketName does not exist in your GCP project.","error":"Error: The API returned an error: Error: The bucket 'my-bucket' does not exist"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}