vite-plugin-html icon indicating copy to clipboard operation
vite-plugin-html copied to clipboard

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

Open FarhanMS123 opened this issue 1 year ago • 1 comments

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?

FarhanMS123 avatar Feb 12 '24 12:02 FarhanMS123

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

mhornbacher avatar Mar 27 '24 20:03 mhornbacher