Created
June 27, 2022 10:56
-
-
Save takunagai/a6287ecc1a8c3783505879d0cbf48b7c to your computer and use it in GitHub Desktop.
[@wordpress/scripts custom entry point] #WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @ 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