File tree 5 files changed +26
-17
lines changed
5 files changed +26
-17
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " wrangler " : minor
3
+ ---
4
+
5
+ feature: add warning when trying to use ` wrangler dev ` inside a WebContainer
Original file line number Diff line number Diff line change 135
135
"@types/supports-color" : " ^8.1.1" ,
136
136
"@types/ws" : " ^8.5.3" ,
137
137
"@types/yargs" : " ^17.0.10" ,
138
- "@webcontainer/env" : " ^1.0.1 " ,
138
+ "@webcontainer/env" : " ^1.1.0 " ,
139
139
"body-parser" : " ^1.20.0" ,
140
140
"chalk" : " ^2.4.2" ,
141
141
"cli-table3" : " ^0.6.3" ,
Original file line number Diff line number Diff line change 1
1
import path from "node:path" ;
2
+ import { isWebContainer } from "@webcontainer/env" ;
2
3
import chalk from "chalk" ;
3
4
import { watch } from "chokidar" ;
4
5
import getPort from "get-port" ;
@@ -293,6 +294,15 @@ export function devOptions(yargs: CommonYargsArgv) {
293
294
type DevArguments = StrictYargsOptionsToInterface < typeof devOptions > ;
294
295
295
296
export async function devHandler ( args : DevArguments ) {
297
+ if ( isWebContainer ( ) ) {
298
+ logger . error (
299
+ `Oh no! 😟You tried to run \`wrangler dev\` in a StackBlitz WebContainer. 🤯
300
+ This is currently not supported 😭, but we think that we'll get it to work soon... hang in there! 🥺`
301
+ ) ;
302
+ process . exitCode = 1 ;
303
+ return ;
304
+ }
305
+
296
306
if ( ! ( args . local || args . experimentalLocal ) ) {
297
307
const isLoggedIn = await loginOrRefreshIfRequired ( ) ;
298
308
if ( ! isLoggedIn ) {
Original file line number Diff line number Diff line change @@ -213,7 +213,6 @@ import path from "node:path";
213
213
import url from "node:url" ;
214
214
import { TextEncoder } from "node:util" ;
215
215
import TOML from "@iarna/toml" ;
216
- import { HostURL } from "@webcontainer/env" ;
217
216
import { fetch } from "undici" ;
218
217
import {
219
218
getConfigCache ,
@@ -365,15 +364,7 @@ export function validateScopeKeys(
365
364
return scopes . every ( ( scope ) => scope in Scopes ) ;
366
365
}
367
366
368
- /**
369
- * To allow OAuth callbacks in environments such as WebContainer we need to
370
- * create a host URL which only resolves `localhost` to a WebContainer
371
- * hostname if the process is running in a WebContainer. On local this will
372
- * be a no-op and it leaves the URL unmodified.
373
- *
374
- * @see https://www.npmjs.com/package/@webcontainer/env
375
- */
376
- const CALLBACK_URL = HostURL . parse ( "http://localhost:8976/oauth/callback" ) . href ;
367
+ const CALLBACK_URL = "http://localhost:8976/oauth/callback" ;
377
368
378
369
let LocalState : State = {
379
370
...getAuthTokens ( ) ,
You can’t perform that action at this time.
0 commit comments