Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DamonCais opened this issue Jul 19, 2023 · 2 comments
Open

Comments

@DamonCais
Copy link

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

@DamonCais DamonCais changed the title 配置中包含base的情况下,多页配置就会失效。 [BUG]配置中包含base的情况下,多页配置就会失效。 Jul 19, 2023
@vincent-li
Copy link

vincent-li commented Dec 28, 2023

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
Copy link

同上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants