Vite

Since version 5, the default compiler for TailPress is Vite.

Working with a secure development server

If your local development web server is serving your site via HTTPS, you may run into issues connecting to the Vite development server.

To fix this, install @vitejs/plugin-basic-ssl by running:

1npm install @vitejs/plugin-basic-ssl --save-dev

Next, we will add this to vite.config.mjs:

1import basicSsl from '@vitejs/plugin-basic-ssl'

And register the plugin:

1plugins: [
2 tailwindcss(),
3 basicSsl() // <----
4],

Then call the ssl method on the ViteCompiler instance in functions.php so that it uses https instead of http:

1->withCompiler(new TailPress\Framework\Assets\ViteCompiler, fn($compiler) => $compiler
2 ->registerAsset('resources/css/app.css')
3 ->registerAsset('resources/js/app.js')
4 ->editorStyleFile('resources/css/editor-style.css')
5 ->ssl(verify: false) // Add this method
6)

Finally, you might need to go to https://localhost:3000 in your browser. You'll see a warning that there is no certificate, and you have to accept the security warning.

Revert back to Larvel Mix

If you prefer to use Laravel Mix instead of Vite, you can do so by following this guide.