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>
73 lines
2.0 KiB
JavaScript
73 lines
2.0 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
exports.__esModule = true;
|
|
exports.bundle = bundle;
|
|
exports.filePath = filePath;
|
|
exports.fixture = fixture;
|
|
|
|
var _path = _interopRequireDefault(require("path"));
|
|
|
|
var _webpack = _interopRequireDefault(require("webpack"));
|
|
|
|
var _memoryFs = _interopRequireDefault(require("memory-fs"));
|
|
|
|
var _src = _interopRequireDefault(require("../src"));
|
|
|
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
|
|
/* global wallaby */
|
|
var workingFolder = typeof wallaby !== 'undefined' ? _path["default"].join(wallaby.localProjectDir, 'test') : __dirname;
|
|
|
|
function fixture(fileName) {
|
|
return _path["default"].join(workingFolder, 'fixtures', fileName);
|
|
}
|
|
|
|
function bundle(options, modifier) {
|
|
if (modifier === void 0) {
|
|
modifier = function modifier(x) {
|
|
return x;
|
|
};
|
|
}
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
var compiler = (0, _webpack["default"])(modifier({
|
|
entry: {
|
|
bundle: fixture('index.js')
|
|
},
|
|
output: {
|
|
filename: '[name].js'
|
|
},
|
|
resolveLoader: {
|
|
modules: [_path["default"].resolve(workingFolder, '..', 'node_modules')]
|
|
},
|
|
module: {
|
|
rules: [{
|
|
test: /\.css$/,
|
|
use: [{
|
|
loader: _miniCssExtractPlugin["default"].loader
|
|
}, 'css-loader']
|
|
}]
|
|
},
|
|
plugins: [new _miniCssExtractPlugin["default"]({
|
|
filename: '[name].css'
|
|
}), new _src["default"](options)]
|
|
}));
|
|
var memoryFileSystem = new _memoryFs["default"]();
|
|
compiler.outputFileSystem = memoryFileSystem;
|
|
compiler.run(function (err, stats) {
|
|
if (err) {
|
|
return reject(err);
|
|
} else if (stats.hasErrors()) {
|
|
return reject(new Error(stats.toString()));
|
|
} else {
|
|
resolve(memoryFileSystem);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
function filePath(name) {
|
|
return _path["default"].join(process.cwd(), 'dist', name);
|
|
} |