How to link Angular project dist directory to PlatformIO SPIFFS data directory
For tips how to make the Angular build small enough to fit into the SPIFFS image, see How to make Angular work with ESP32 SPIFFS / ESPAsyncWebserver
When you are building a PlatformIO image, you can easily make the dist/[project_name] directory from the Angular project directory appear in the SPIFFS image by using a symlink.
My config tells the server to serve from the www
subdirectory.
server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html");
Therefore, we first need to create the data
directory in the same directory where platformio.ini
is located:
mkdir data
Now we can create a symlink from the angular dist
directory to data/www
, for example**:**
ln -s ../MyUI/dist/myui data/www
PlatformIO will automatically handle the symlink, if the directory exists.