SULPHURIC ACID
SULPHURIC ACID

Reputation: 337

how to run flutter web build locally

after:

flutter build web

built is ready in path: build/web

how can I run it locally? without using

flutter run -d chrome

Upvotes: 4

Views: 4013

Answers (1)

Albert Renshaw
Albert Renshaw

Reputation: 17892

On Mac

Run the following terminal command to start up an apache server:

$ sudo apachectl start

Then, move the contents of your build/web folder to /Library/WebServer/Documents/

(Note: Index.html base href should be "/" if you had previously modified it)

Now, navigate web browser to localhost

Once done, kill the apache server with the following command:

$ sudo apachectl graceful-stop


On Windows

Download XAMPP, install, allow it to run on local networks if prompted, then launch the XAMPP app (it will likely have launched on its own).

In the XAMPP app, find the row for "Apache" and click the "Start" button to start up the web server

Move the contents of your build/web folder to C:/xampp/htdocs/

(Note: Index.html base href should be "/" if you had previously modified it)

Now navigate web browser to 127.0.0.1/index.html

Once done, open the XAMPP app and click "stop" on the Apache row.

Upvotes: 2

Related Questions