File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 66 schedule :
77 - cron : ' 0 0 * * *'
88
9+ env :
10+ LARAVEL_BYPASS_ENV_CHECK : 1
11+
912jobs :
1013 tests :
1114 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
105105 const env = loadEnv ( mode , userConfig . envDir || process . cwd ( ) , '' )
106106 const assetUrl = env . ASSET_URL ?? ''
107107
108+ ensureCommandShouldRunInEnvironment ( command , env )
109+
108110 return {
109111 base : command === 'build' ? resolveBase ( pluginConfig , assetUrl ) : '' ,
110112 publicDir : false ,
@@ -202,6 +204,31 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
202204 }
203205}
204206
207+ /**
208+ * Validate the command can run in the given environment.
209+ */
210+ function ensureCommandShouldRunInEnvironment ( command : 'build' | 'serve' , env : Record < string , string > ) : void {
211+ if ( command === 'build' || env . LARAVEL_BYPASS_ENV_CHECK === '1' ) {
212+ return ;
213+ }
214+
215+ if ( typeof env . LARAVEL_VAPOR !== 'undefined' ) {
216+ throw Error ( 'You should not run the Vite HMR server on Vapor. You should build your assets for production instead.' ) ;
217+ }
218+
219+ if ( typeof env . LARAVEL_FORGE !== 'undefined' ) {
220+ throw Error ( 'You should not run the Vite HMR server in your Forge deployment script. You should build your assets for production instead.' ) ;
221+ }
222+
223+ if ( typeof env . LARAVEL_ENVOYER !== 'undefined' ) {
224+ throw Error ( 'You should not run the Vite HMR server in your Envoyer hook. You should build your assets for production instead.' ) ;
225+ }
226+
227+ if ( typeof env . CI !== 'undefined' ) {
228+ throw Error ( 'You should not run the Vite HMR server in CI environments. You should build your assets for production instead.' ) ;
229+ }
230+ }
231+
205232/**
206233 * The version of Laravel being run.
207234 */
You can’t perform that action at this time.
0 commit comments