Skip to content

Instantly share code, notes, and snippets.

@takunagai
Created June 27, 2022 10:56
Show Gist options
  • Save takunagai/a6287ecc1a8c3783505879d0cbf48b7c to your computer and use it in GitHub Desktop.
Save takunagai/a6287ecc1a8c3783505879d0cbf48b7c to your computer and use it in GitHub Desktop.
[@wordpress/scripts custom entry point] #WordPress
/**
* @ wordpress/scripts を使用してブロックを構築し、
* カスタムエントリポイントを使用する場合、
* これをカスタム webpack.config.js ファイルに追加
* @see https://twitter.com/ryanwelcher/status/1539696638817701888
*/
// オリジナルの設定を @wordpress/scripts パッケージからインポート
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
// src ディレクトリにあるエントリポイントを検索し、生成するヘルパーをインポート
const { getWebpackEntryPoints } = require( '@wordpress/scripts/utils/config' );
// webpack の設定を拡張し、任意の新しいエントリーポイントを追加
module.exports = {
...defaultConfig,
entry: {
...getWebpackEntryPoints(),
cuntom: './src/index.js',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment