npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

sfdx-deploy-webpack-plugin

v1.1.1

Published

Webpack plugin that deploys your local SFDX project to your Salesforce Evironment.

Readme

Latest Stable Version NPM Downloads License

Sfdx Deploy Webpack Plugin

Webpack plugin that deploys your local SFDX project to your Salesforce Evironment (Developer|Sandbox|Scratch) after webpack compilation.

Default Behavior

sfdx-deploy-webpack-plugin by default watches your local file system during webpack compilation and deploys those files to you default target org. Via the provided options you're able to alter the target org and files you wish to deploy. (Useful for an entire project deploy)

Primary use case is to deploy your webpack generated assets to your salesforce org via staticresources along w/ other newly (created|modified) salesforce metadata files. However w/ the provided options can alter behavior and deploy other assets or your entrie project.

Learn More

Requirements

Additional Requirements:

  • Need to have your default development org authenticated
  • Need to have your project in salesforce's source format project structure.

Install

npm i sfdx-deploy-webpack-plugin --save-dev

Setup

Import/Require the package into your webpack config file

webpack.config.js

const path = require("path");
const SfdxDeploy = require('sfdx-deploy-webpack-plugin');

module.exports = {
  entry: './src/app.js',
  output: {
    filename: "[name]/[name].bundle.js",
    path: path.resolve(__dirname, "./force-app/main/default/staticresources/dist"),
  }
  plugins: [
    new SfdxDeploy()
  ],
};

sfdx-deploy-webpack-plugin plugin works without any configuration. :)

| Name | Type | Default | Required | Description | | :---------: | :--------: | :-------------------------: | :------: | :------------------------------------------------------------------------- | | projectPath | {String} | ./force-app/main/default/ | false | path to your sfdx project directory | | delay | {Number} | 250 | false | delays the deployment of your files after webpack compilation is finished. | | deployArgs | {Object} | N/A | false | More info below |

deployArgs

{
  /**
   * (Optional)
   * A username or alias for the target org. Overrides the default target org.
   *
   * Type: string
   */
  targetusername?: string;
  /**
   * (Optional)
   * Override the API version used for API requests made by this command.
   *
   * Type:
   */
  apiversion?: string;
  /**
   * (Optional)
   * A comma-separated list of names of metadata components to deploy to the org.
   *
   * If you specify this parameter, don’t specify {sourcepath} or {manifest}.
   *
   * Type: array
   */
  metadata?: string[];
  /**
   * (Optional)
   * (Attention) This is set automatically. If you wish to deploy entire project manually pass in this argument pointing to the root of your project OR path to your {manifest}
   *
   * A comma-separated list of paths to the local source files to deploy. The supplied paths can be to a single file (in which
   * case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types
   * in the directory and its sub-directories).
   *
   * If you specify this parameter, don’t specify {manifest} or {metadata}.
   *
   * Type: array
   */
  sourcepath?: string | string[];
  /**
   * (Optional)
   * The complete path for the manifest (package.xml) file that specifies the components to deploy. All child components are included.
   *
   * If you specify this parameter, don’t specify {metadata} or {sourcepath}.
   *
   * Type: filepath
   */
  manifest?: string;
}

NOTE: Currently if you specify {metadata}, {sourcepath} or {manifest}, the plugin does NOT watch the filesystem and deploys any filesystem changes

Deploy to a specific org

webpack.config.js

const path = require('path');
const SfdxDeployPlugin = require('sfdx-deploy-webpack-plugin');

module.exports = {
  ...
  plugins: [
    new SfdxDeployPlugin({
      projectPath: path.resolve('./force-app/main/default/'),
      deployArgs: {
        /* can be authenticated username or alias  */
        targetusername: '[email protected]'
      }
    })
  ]
}

Deploy entire project

webpack.config.js

const path = require('path');
const SfdxDeployPlugin = require('sfdx-deploy-webpack-plugin');

module.exports = {
  ...
  plugins: [
    new SfdxDeployPlugin({
      projectPath: path.resolve('./force-app/main/default/'),
      deployArgs: {
        // if this is your default org don't need to include
        targetusername: 'myDeveloperOrg',
        sourcepath: path.resolve('./force-app'),
        /* alt can specify path to your manifest xml file */
        /* manifest: path.resolve('./manifest/package.xml') */
      },
    }),
  ],
};

Deploy specific metadata components - (Ex. Apex, Visualforce, Lwc)

webpack.config.js

const SfdxDeployPlugin = require('sfdx-deploy-webpack-plugin');

module.exports = {
  ...
  plugins: [
    new SfdxDeployPlugin({
      deployArgs: {
        metadata: [
        'ApexClass',
        'ApexPage',
        'LightningComponentBundle'
        ]
        /* alt can pass an arry of paths or comma sep to {sourcepath} */
        /*
          sourcepath: [
            path.resolve(__dirname, 'force-app/main/default/classes/'),
            path.resolve(__dirname, 'force-app/main/default/pages/')
            path.resolve(__dirname, 'force-app/main/default/lwc/')
          ]
        /*
      }
    })
  ]
}

Toggle Prod and Dev builds w/ webpack arguments

package.json

"scripts": {
  "dev:quickDeploy": "webpack --mode dev --env.development --env.deploy quick",
  "dev:fullDeploy": "webpack --mode dev --env.development --env.deploy full",
  "prod:fullDeploy": "webpack --env.production --env.deploy full"
}

webpack.config.js

const SfdxDeployPlugin = require('sfdx-deploy-webpack-plugin');
const path = require('path');


module.exports = (env, argv) => {

  const mode = env.production ? 'production' : 'development';
  const deployMode = env.deploy;

  const prodDeploy = {
    sourcepath: path.resolve('./force-app/main/default/')
  };

  return {
    ...
    plugins: [
      new SfdxDeployPlugin({
        projectPath: path.resolve('force-app', 'main', 'default'),
        deployArgs: deployMode === 'full' ? prodDeploy : {}
      })
    ]
  }
}