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

[BUG]配置中包含base的情况下,多页配置就会失效。 #122

Open DamonCais opened 1 year ago

DamonCais commented 1 year ago

配置中包含base的情况下,多页配置就会失效。然后所有的页面,都会指向index.html

vincent-li commented 11 months ago

plugins: [
    react({}),
    createHtmlPlugin({
      minify: false,
      viteNext: true,
      pages: [
        {
          entry: './src/entry/search.jsx',
          filename: 'search.html',
          template: './index.html',
          injectOptions: {
            data: {
              title: '検索結果'
            },
          },
        },
        {
          entry: './src/entry/search_popup.jsx',
          filename: 'search_popup.html',
          template: './index.html',
          injectOptions: {
            data: {
              title: '2検索結果'
            },
          },
        },
      ],
    })
  ],
  build: {
    rollupOptions: {
      input: {
        search: './src/entry/search.jsx',
        search_popup: './src/entry/search_popup.jsx'
      }
    }
  },

当我使用这个配置配置多页的时候,总是第一个配置生效,即使访问第二个页面路由,也是返回第一个配置的结果。而且,使用任何名称非index的html模版,都不会生效。是不是姿势不对,补充完毕
vonlyinno commented 7 months ago

同上