diff --git a/packages/toolkit/webpack/config.build.js b/packages/toolkit/webpack/config.build.js index 096d3761..2bb9df79 100644 --- a/packages/toolkit/webpack/config.build.js +++ b/packages/toolkit/webpack/config.build.js @@ -152,4 +152,44 @@ const globalBundle = createWebpackConfig({ }, }); -module.exports = [libBundle, libBundleWithReact, globalBundle]; \ No newline at end of file + +const globalBundleWithReact = createWebpackConfig({ + mode: 'production', + tsconfigPath: path.join(__dirname, '../../../tsconfig.json'), + outputPath: path.join(__dirname, '../../core/bundle'), + define: Object.keys(define).reduce((obj, key) => { + obj[key] = JSON.stringify(define[key]); + return obj; + }, {}), + webpackConfig: { + context: path.join(__dirname, '../../..'), + entry: { + [config.appGlobalMinWithReactEntry]: './packages/core/src', + }, + output: { + library: 'Alex', + libraryTarget: 'global', + }, + externals: [ + { + moment: 'moment', + }, + ], + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + parallel: true, + include: /\.min\.js$/, + }), + new CssMinimizerPlugin({ + include: /\.min\.css$/, + }), + ], + concatenateModules: false, + splitChunks: false, + }, + }, +}); + +module.exports = [libBundle, libBundleWithReact, globalBundle, globalBundleWithReact]; \ No newline at end of file diff --git a/packages/toolkit/webpack/util/index.js b/packages/toolkit/webpack/util/index.js index 8ad6ba85..c20e6993 100644 --- a/packages/toolkit/webpack/util/index.js +++ b/packages/toolkit/webpack/util/index.js @@ -36,6 +36,7 @@ exports.config = { appEntryWithReact: 'codeblitz-with-react', appGlobalEntry: 'codeblitz.global', appGlobalMinEntry: 'codeblitz.global.min', + appGlobalMinWithReactEntry: 'codeblitz.global-with-react.min', editorEntry: 'codeblitz.editor', editorAllEntry: 'codeblitz.editor.all', editorAllGlobalEntry: 'codeblitz.editor.all.global',