MisterAI's picture
download
raw
1.52 kB
#!/bin/bash
set -e
echo "๐Ÿ“ฆ Bundling React app to single HTML artifact..."
# Check if we're in a project directory
if [ ! -f "package.json" ]; then
echo "โŒ Error: No package.json found. Run this script from your project root."
exit 1
fi
# Check if index.html exists
if [ ! -f "index.html" ]; then
echo "โŒ Error: No index.html found in project root."
echo " This script requires an index.html entry point."
exit 1
fi
# Install bundling dependencies
echo "๐Ÿ“ฆ Installing bundling dependencies..."
pnpm add -D parcel @parcel/config-default parcel-resolver-tspaths html-inline
# Create Parcel config with tspaths resolver
if [ ! -f ".parcelrc" ]; then
echo "๐Ÿ”ง Creating Parcel configuration with path alias support..."
cat > .parcelrc << 'EOF'
{
"extends": "@parcel/config-default",
"resolvers": ["parcel-resolver-tspaths", "..."]
}
EOF
fi
# Clean previous build
echo "๐Ÿงน Cleaning previous build..."
rm -rf dist bundle.html
# Build with Parcel
echo "๐Ÿ”จ Building with Parcel..."
pnpm exec parcel build index.html --dist-dir dist --no-source-maps
# Inline everything into single HTML
echo "๐ŸŽฏ Inlining all assets into single HTML file..."
pnpm exec html-inline dist/index.html > bundle.html
# Get file size
FILE_SIZE=$(du -h bundle.html | cut -f1)
echo ""
echo "โœ… Bundle complete!"
echo "๐Ÿ“„ Output: bundle.html ($FILE_SIZE)"
echo ""
echo "You can now use this single HTML file as an artifact in Claude conversations."
echo "To test locally: open bundle.html in your browser"

Xet Storage Details

Size:
1.52 kB
ยท
Xet hash:
84f4b03d56fd99be4e7b2a6111ab4f3244f0c03f6439e59fff3225511450ae69

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.