Changeset 56699
- Timestamp:
- 09/26/2023 06:49:55 AM (3 years ago)
- Location:
- trunk/tools/webpack
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/webpack/blocks.js
r56255 r56699 2 2 * External dependencies 3 3 */ 4 const { DefinePlugin } = require( 'webpack' );5 4 const CopyWebpackPlugin = require( 'copy-webpack-plugin' ); 6 5 … … 13 12 * Internal dependencies 14 13 */ 15 const { normalizeJoin, stylesTransform, baseConfig, baseDir} = require( './shared' );14 const { baseDir, getBaseConfig, normalizeJoin, stylesTransform } = require( './shared' ); 16 15 const { 17 16 isDynamic, … … 63 62 } ) ); 64 63 64 const baseConfig = getBaseConfig( env ); 65 65 const config = { 66 ...baseConfig ( env ),66 ...baseConfig, 67 67 entry: { 68 68 'file/view': normalizeJoin(baseDir, `node_modules/@wordpress/block-library/build-module/file/view` ), … … 77 77 }, 78 78 plugins: [ 79 new DefinePlugin( { 80 // Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging. 81 'process.env.IS_GUTENBERG_PLUGIN': false, 82 'process.env.FORCE_REDUCED_MOTION': JSON.stringify( 83 process.env.FORCE_REDUCED_MOTION, 84 ), 85 } ), 79 ...baseConfig.plugins, 86 80 new DependencyExtractionPlugin( { 87 81 injectPolyfill: false, -
trunk/tools/webpack/packages.js
r56048 r56699 2 2 * External dependencies 3 3 */ 4 const { DefinePlugin } = require( 'webpack' );5 4 const CopyWebpackPlugin = require( 'copy-webpack-plugin' ); 6 5 const LiveReloadPlugin = require( 'webpack-livereload-plugin' ); … … 18 17 * Internal dependencies 19 18 */ 20 const { normalizeJoin, stylesTransform, baseConfig, baseDir} = require( './shared' );19 const { baseDir, getBaseConfig, normalizeJoin, stylesTransform } = require( './shared' ); 21 20 const { dependencies } = require( '../../package' ); 22 21 … … 130 129 } ) ); 131 130 131 const baseConfig = getBaseConfig( env ); 132 132 const config = { 133 ...baseConfig ( env ),133 ...baseConfig, 134 134 entry: packages.reduce( ( memo, packageName ) => { 135 135 memo[ packageName ] = { … … 152 152 }, 153 153 plugins: [ 154 new DefinePlugin( { 155 // Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging. 156 'process.env.IS_GUTENBERG_PLUGIN': false, 157 // Inject the `IS_WORDPRESS_CORE` global, used for feature flagging. 158 'process.env.IS_WORDPRESS_CORE': true, 159 'process.env.FORCE_REDUCED_MOTION': JSON.stringify( 160 process.env.FORCE_REDUCED_MOTION 161 ), 162 } ), 154 ...baseConfig.plugins, 163 155 new DependencyExtractionPlugin( { 164 156 injectPolyfill: true, -
trunk/tools/webpack/shared.js
r55193 r56699 2 2 * External dependencies 3 3 */ 4 const { DefinePlugin } = require( 'webpack' ); 4 5 const TerserPlugin = require( 'terser-webpack-plugin' ); 5 6 const postcss = require( 'postcss' ); … … 8 9 const baseDir = join( __dirname, '../../' ); 9 10 10 const baseConfig = ( env ) => {11 const getBaseConfig = ( env ) => { 11 12 const mode = env.environment; 12 13 … … 42 43 stats: 'errors-only', 43 44 watch: env.watch, 45 plugins: [ 46 new DefinePlugin( { 47 // Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging. 48 'process.env.IS_GUTENBERG_PLUGIN': false, 49 // Inject the `IS_WORDPRESS_CORE` global, used for feature flagging. 50 'process.env.IS_WORDPRESS_CORE': true, 51 // Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript. 52 SCRIPT_DEBUG: mode === 'development', 53 } ), 54 ], 44 55 }; 45 56 … … 80 91 module.exports = { 81 92 baseDir, 82 baseConfig,93 getBaseConfig, 83 94 normalizeJoin, 84 95 stylesTransform,
Note: See TracChangeset
for help on using the changeset viewer.