Skip to content

Instantly share code, notes, and snippets.

@qutek
Forked from bahiirwa/webpack.config.js
Created September 19, 2023 03:08
Show Gist options
  • Save qutek/284346c5bc47d25d2e0b8738a752a604 to your computer and use it in GitHub Desktop.
Save qutek/284346c5bc47d25d2e0b8738a752a604 to your computer and use it in GitHub Desktop.

Revisions

  1. @bahiirwa bahiirwa created this gist Mar 26, 2023.
    19 changes: 19 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    // Set from https://www.npmjs.com/package/@wordpress/scripts
    // Add package.json with the @wordpress/scripts dependency.
    // Add a root file called webpack.config.js

    // Import the original config from the @wordpress/scripts package.
    const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );

    // Import the helper to find and generate the entry points in the src directory
    const { getWebpackEntryPoints } = require( '@wordpress/scripts/utils/config' );

    // Add any a new entry point by extending the webpack config.
    module.exports = {
    ...defaultConfig,
    entry: {
    ...getWebpackEntryPoints(),
    variations: './variations/index.js', // to variations file in theme.
    'stream-meta-panel': './stream-meta-panel/index.js', // Custom directory having JS to compile
    },
    };