File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -308,10 +308,20 @@ function createDriver(
308
308
storageArea : 'local' | 'session' | 'sync' | 'managed' ,
309
309
) : WxtStorageDriver {
310
310
const getStorageArea = ( ) => {
311
- if ( browser . storage == null )
311
+ if ( browser . runtime == null ) {
312
+ throw Error (
313
+ [
314
+ "'wxt/storage' must be loaded in a web extension environment" ,
315
+ '\n - If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371' ,
316
+ " - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/testing.html\n" ,
317
+ ] . join ( '\n' ) ,
318
+ ) ;
319
+ }
320
+ if ( browser . storage == null ) {
312
321
throw Error (
313
322
"You must add the 'storage' permission to your manifest to use 'wxt/storage'" ,
314
323
) ;
324
+ }
315
325
316
326
return browser . storage [ storageArea ] ;
317
327
} ;
You can’t perform that action at this time.
0 commit comments