Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
875 B
JavaScript
45 lines
875 B
JavaScript
// Exclude bundled WordPress packages from the list.
|
|
const wpPackagesRegExp = '^@wordpress/(?!(icons|interface|style-engine))';
|
|
|
|
const config = {
|
|
extends: [
|
|
require.resolve( './jsx-a11y.js' ),
|
|
require.resolve( './custom.js' ),
|
|
require.resolve( './react.js' ),
|
|
require.resolve( './esnext.js' ),
|
|
require.resolve( './i18n.js' ),
|
|
],
|
|
plugins: [ 'import' ],
|
|
env: {
|
|
node: true,
|
|
},
|
|
globals: {
|
|
window: true,
|
|
document: true,
|
|
SCRIPT_DEBUG: 'readonly',
|
|
wp: 'readonly',
|
|
},
|
|
settings: {
|
|
'import/internal-regex': wpPackagesRegExp,
|
|
'import/extensions': [ '.js', '.jsx' ],
|
|
},
|
|
rules: {
|
|
'import/no-extraneous-dependencies': [
|
|
'error',
|
|
{
|
|
peerDependencies: true,
|
|
},
|
|
],
|
|
'import/no-unresolved': [
|
|
'error',
|
|
{
|
|
ignore: [ wpPackagesRegExp ],
|
|
},
|
|
],
|
|
'import/default': 'warn',
|
|
'import/named': 'warn',
|
|
},
|
|
};
|
|
|
|
module.exports = config;
|