mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
d13208e291
This updates the following npm dependencies: - `autoprefixer` to version `10.4.16`. - `grunt-contrib-qunit` to version `8.0.1`. - `postcss` to version `8.4.30`. - `react-refresh` to version `0.14.0`. - `sass` to version `1.68.0`. - `sinon` to version `16.0.0`. - `uuid` to version `9.0.1`. - `tslib` to version `2.6.2`. This change accompanies a similar one in the Gutenberg repository: https://github.com/WordPress/gutenberg/pull/54657. Props gziolo, desrosj. Fixes #58863. git-svn-id: https://develop.svn.wordpress.org/trunk@56647 602fd350-edb4-49c9-b593-d223f7449a82
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
/**
|
|
* External dependencies
|
|
*/
|
|
const { join } = require( 'path' );
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
|
|
|
|
const baseDir = join( __dirname, '../../' );
|
|
|
|
module.exports = function( env = { environment: 'production', 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 sharedConfig = {
|
|
mode: 'development',
|
|
target: 'browserslist',
|
|
output: {
|
|
filename: `[name]${ suffix }.js`,
|
|
path: join( baseDir, `${ buildTarget }/js/dist/development` ),
|
|
},
|
|
};
|
|
|
|
// See https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#externalising-react.
|
|
return [
|
|
{
|
|
...sharedConfig,
|
|
name: 'react-refresh-entry',
|
|
entry: {
|
|
'react-refresh-entry':
|
|
'@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js',
|
|
},
|
|
plugins: [ new DependencyExtractionWebpackPlugin( {
|
|
outputFilename: `../../../assets/script-loader-[name]${ suffix }.php`,
|
|
} ) ],
|
|
},
|
|
{
|
|
...sharedConfig,
|
|
name: 'react-refresh-runtime',
|
|
entry: {
|
|
'react-refresh-runtime': {
|
|
import: 'react-refresh/runtime',
|
|
library: {
|
|
name: 'ReactRefreshRuntime',
|
|
type: 'window',
|
|
},
|
|
},
|
|
},
|
|
plugins: [
|
|
new DependencyExtractionWebpackPlugin( {
|
|
useDefaults: false,
|
|
outputFilename: `../../../assets/script-loader-[name]${ suffix }.php`
|
|
} ),
|
|
],
|
|
},
|
|
];
|
|
};
|