const path = require("path"); const glob = require("glob"); /* 各ブロックのCSSファイルをentryに追加するためのオブジェクトを作成*/ const blockStyleDir = "src/styles"; const blockEntries = glob .sync("blocks/**/*.css", { cwd: blockStyleDir }) .map((key) => [`styles/${key.replace(".css", "")}`, path.resolve(process.cwd(), blockStyleDir, key)]); const blockEntriesObj = Object.fromEntries(blockEntries); module.exports = { ...defaultConfig, entry: { ...defaultConfig.entry, "styles/theme/theme": path.resolve(process.cwd(), "src/styles/theme/theme.css"), ...blockEntriesObj, }, plugins: [ ...defaultConfig.plugins, new RemoveEmptyScriptsPlugin({ stage: RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS, }), ], watchOptions: { ignored: ["**/node_modules", "**/build/**"], }, }; 49