vschttpd 1.0.0+3 copy "vschttpd: ^1.0.0+3" to clipboard
vschttpd: ^1.0.0+3 copied to clipboard

Local development server with support for running flutter web application in vscode webview extensions

VSCHTTPD

VSCHTTPD #

Dart server for hosting your local flutter web apps inside the VS Code extension webview iframe

Instalation #

pub global activate vschttpd

Run #

inside a flutter app run

vschttpd -p YOURPORT -r build/web

Configure #

vschttpd --help
-p, --port                Port to listen on.
                          (defaults to "9001")
-r, --root (mandatory)    The path to serve. If not set, the current directory is used.
-a, --address             Address to listen on.
                          (defaults to "localhost")

VS Code Extensions #

Inside your extensions web panel use this snippet for bypass cors

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="Content-Security-Policy" content="default-src 'none'; frame-src ${uri} ${cspSource} http: https:; img-src ${cspSource}; style-src ${uri} ${cspSource}; script-src ${uri} 'nonce-${nonce}';">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="${stylesResetUri}" rel="stylesheet">
        <link href="${stylesMainUri}" rel="stylesheet"> 
    </head>
    <body>
        <iframe id="iframe-content" src="${uri}" frameborder="0" scroll="no"/>
        <script type="text/javascript" nonce="${nonce}" src="${scriptUri}"></script>  
    </body>
</html>

where uri should be

http://YOURADDRESS:PORT
2
likes
140
points
8
downloads

Publisher

verified publisherzoocityboy.space

Weekly Downloads

Local development server with support for running flutter web application in vscode webview extensions

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

args, path, shelf, shelf_static

More

Packages that depend on vschttpd