Server : nginx/1.18.0 System : Linux localhost 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64 User : www-data ( 33) PHP Version : 8.0.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/ecommerce/node_modules/laravel-mix/src/ |
let webpack = require('webpack');
let path = require('path');
class Api {
/**
* Enable sourcemap support.
*
* @param {Boolean} generateForProduction
* @param {string} devType
* @param {string} productionType
*/
sourceMaps(
generateForProduction = true,
devType = 'eval-source-map',
productionType = 'source-map'
) {
let type = devType;
if (Mix.inProduction()) {
type = generateForProduction ? productionType : false;
}
Config.sourcemaps = type;
return this;
}
/**
* Override the default path to your project's public directory.
*
* @param {string} defaultPath
*/
setPublicPath(defaultPath) {
Config.publicPath = path.normalize(defaultPath.replace(/\/$/, ''));
return this;
}
/**
* Set a prefix for all generated asset paths.
*
* @param {string} path
*/
setResourceRoot(path) {
Config.resourceRoot = path;
return this;
}
/**
* Merge custom config with the provided webpack.config file.
*
* @param {object} config
*/
webpackConfig(config) {
config = typeof config == 'function' ? config(webpack) : config;
Config.webpackConfig = require('webpack-merge').smart(
Config.webpackConfig,
config
);
return this;
}
/**
* Merge custom Babel config with Mix's default.
*
* @param {object} config
*/
babelConfig(config) {
Config.babelConfig = config;
return this;
}
/**
* Set Mix-specific options.
*
* @param {object} options
*/
options(options) {
Config.merge(options);
return this;
}
/**
* Register a Webpack build event handler.
*
* @param {Function} callback
*/
then(callback) {
Mix.listen('build', callback);
return this;
}
/**
* Register an event listen for when the webpack
* config object has been fully generated.
*
* @param {Function} callback
*/
override(callback) {
Mix.listen('configReadyForUser', callback);
return this;
}
/**
* Helper for determining a production environment.
*/
inProduction() {
return Mix.inProduction();
}
/**
* Helper to allow for fluent, conditional configuration.
*/
when(condition, callback) {
if (condition) {
callback(this);
}
return this;
}
}
module.exports = Api;