compileHandle('mix'); } /** * Create the command array to create a Process object with */ protected function createCommand(string $configPath): array { $basePath = base_path(); $command = $this->argument('webpackArgs') ?? []; array_unshift( $command, $basePath . sprintf('%1$snode_modules%1$s.bin%1$swebpack', DIRECTORY_SEPARATOR), 'build', $this->option('silent') ? '--stats=none' : '--progress', '--config=' . $this->getJsConfigPath($configPath) ); return $command; } /** * Create the temporary mix.webpack.js config file to run webpack with */ protected function beforeExecution(string $configPath): void { $basePath = base_path(); $fixture = File::get(__DIR__ . '/../fixtures/mix.webpack.js.fixture'); $config = Str::swap([ '%base%' => addslashes($basePath), '%notificationInject%' => 'mix._api.disableNotifications();', '%mixConfigPath%' => addslashes($configPath), '%pluginsPath%' => addslashes(plugins_path()), '%appPath%' => addslashes(base_path()), '%silent%' => (int) $this->option('silent'), '%noProgress%' => (int) $this->option('no-progress') ], $fixture); File::put($this->getJsConfigPath($configPath), $config); } /** * Remove the temporary mix.webpack.js file */ protected function afterExecution(string $configPath): void { $webpackConfigPath = $this->getJsConfigPath($configPath); if (File::exists($webpackConfigPath) && File::isFile($webpackConfigPath)) { File::delete($webpackConfigPath); } } }