vbenjs / vite-plugin-html

A vite plugin for processing html. It is developed based on lodash template
MIT License
601 stars 96 forks source link

`pages[].filename` not working. Is this still maintained? #144

Open FarhanMS123 opened 9 months ago

FarhanMS123 commented 9 months ago

Hi! First of all, is this still maintained? I see on the NPM, Version 3.2.* published atleast 2 months ago. But, I can't find related commit in this Github. Does it submitted by different user or has any hidden repository?

Second, I have this config:

import { defineConfig, splitVendorChunkPlugin } from 'vite'
import react from '@vitejs/plugin-react-swc'
import process from "process";
import { createHtmlPlugin } from 'vite-plugin-html'

export default defineConfig({
  plugins: [
    createHtmlPlugin({
      minify: false,
      pages: [
        {
          filename: "test/page-name.page.js.html",
          template: "src/template/clean.html",
          injectOptions: {
            data: {
              script_src: "/test/page-name.page.js"
            }
          },
        },
        {
          filename: "/test/page-name.page.tsx.html",
          template: "/src/template/clean.html",
          injectOptions: {
            data: {
              script_src: "/test/page-name.page.tsx"
            }
          },
        },
      ],
    }),
    splitVendorChunkPlugin(),
    react(),
  ],

  build: {
    rollupOptions: {
      input: {},
      external: /^(.git|.*\.local|dist|node_modules)$/ig,
    },
    outDir: "dist",
    assetsDir: "chunks",
  },

  root: process.cwd(),
  publicDir: false,
  base: "/",
});

With this src/template/clean.html:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <script type="module" src="<%- script_src %>"></script>
  </body>
</html>

But, the output is not like as I intended: image

The clean.html should be renamed test/page-name.page.js.html and test/page-name.page.tsx.html. Is this error? Or the README.md is the error one?

mhornbacher commented 8 months ago

It seems every once in a while something happens here but it is not actively maintained.