idleberg / php-wordpress-vite-assets

Injects assets from a Vite manifest to the Wordpress head, supports themes and plugins
https://packagist.org/packages/idleberg/wordpress-vite-assets
MIT License
133 stars 12 forks source link

Feature Request: Add a demo `vite.config.js` file that works with this class #16

Closed DamChtlv closed 6 months ago

DamChtlv commented 10 months ago

First of all, thanks for your work!

Question

It seems complete (except for the client not included when using just vite #15) Maybe it's related to the client or new version of vite (v5+) but i can't make it work... and maybe it's because of my WP setup or vite config so i'm wondering if that's the case. More infos about the vite.config.js would be helpful :)

Additionnal infos

My WP setup:

Here is a "minimalist" version of my vite.config.js:

// vite.config.js

import { defineConfig } from 'vite';
import { resolve } from 'path';

export default defineConfig({
    build: {
        minify: true,
        manifest: true,
        emptyOutDir: true,
        sourcemap: true,
        outDir: `dist/`,
        rollupOptions: {
            // overwrite default .html entry
            input: resolve(__dirname, 'src/index.js'),
        },
    },
    server: {
        host: true,
        strictPort: true,
        cors: true,
        port: 5173,
        hmr: {
            port: 5173,
            host: 'localhost',
        },
        proxy: {
            '/': {
                target: 'http://localhost:8888',
                changeOrigin: true,
                secure: false,
            },
        },
        watch: { usePolling: true },
    },
});
idleberg commented 10 months ago

I created this package primarily for use with SvelteKit, the config is pretty unspectacular.

import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';

const config: UserConfig = {
    plugins: [sveltekit()],
};

export default config;

Also, I found some POCs for Svelte, Vue, and SolidJS on my computer. They only differ in the use of a different plugin. So no secret sauce involved, pretty basic.

The projects are fairly old, they still use Vite 3, but I've ran into some minor quirks with upgrading from Vite 4 to 5 in some other, unrelated problems. I will try and upgrade my apps and report back. Might take a while though!

github-actions[bot] commented 7 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 6 months ago

This issue was closed because it has been stalled for 14 days with no activity.