mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
This patch, somewhat small brings a lot to WordPress. This includes features like: - DataViews. - Customization tools like box shadow, background size and repeat. - UI improvements in the site editor. - Preferences sharing between the post and site editors. - Unified panels and editors between post and site editors. - Improved template mode in the post editor. - Iterations to multiple interactive blocks. - Preparing the blocks and UI for pattern overrides. - and a lot more. Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj. See #60315. git-svn-id: https://develop.svn.wordpress.org/trunk@57377 602fd350-edb4-49c9-b593-d223f7449a82
94 lines
1.9 KiB
JavaScript
94 lines
1.9 KiB
JavaScript
/**
|
|
* WordPress dependencies
|
|
*/
|
|
const DependencyExtractionPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
const {
|
|
baseDir,
|
|
getBaseConfig,
|
|
normalizeJoin,
|
|
MODULES,
|
|
WORDPRESS_NAMESPACE,
|
|
} = require( './shared' );
|
|
|
|
module.exports = function (
|
|
env = { environment: 'production', watch: false, buildTarget: false }
|
|
) {
|
|
const mode = env.environment;
|
|
const suffix = mode === 'production' ? '.min' : '';
|
|
let buildTarget = env.buildTarget
|
|
? env.buildTarget
|
|
: mode === 'production'
|
|
? 'build'
|
|
: 'src';
|
|
buildTarget = buildTarget + '/wp-includes';
|
|
|
|
const baseConfig = getBaseConfig( env );
|
|
const config = {
|
|
...baseConfig,
|
|
entry: MODULES.map( ( packageName ) =>
|
|
packageName.replace( WORDPRESS_NAMESPACE, '' )
|
|
).reduce( ( memo, packageName ) => {
|
|
memo[ packageName ] = {
|
|
import: normalizeJoin(
|
|
baseDir,
|
|
`node_modules/@wordpress/${ packageName }`
|
|
),
|
|
};
|
|
|
|
return memo;
|
|
}, {} ),
|
|
experiments: {
|
|
outputModule: true,
|
|
},
|
|
output: {
|
|
devtoolNamespace: 'wp',
|
|
filename: `[name]${ suffix }.js`,
|
|
path: normalizeJoin( baseDir, `${ buildTarget }/js/dist` ),
|
|
library: {
|
|
type: 'module',
|
|
},
|
|
environment: { module: true },
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(j|t)sx?$/,
|
|
use: [
|
|
{
|
|
loader: require.resolve( 'babel-loader' ),
|
|
options: {
|
|
cacheDirectory:
|
|
process.env.BABEL_CACHE_DIRECTORY || true,
|
|
babelrc: false,
|
|
configFile: false,
|
|
presets: [
|
|
[
|
|
'@babel/preset-react',
|
|
{
|
|
runtime: 'automatic',
|
|
importSource: 'preact',
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
...baseConfig.plugins,
|
|
new DependencyExtractionPlugin( {
|
|
injectPolyfill: false,
|
|
useDefaults: false,
|
|
} ),
|
|
],
|
|
};
|
|
|
|
return config;
|
|
};
|