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

rollupOptions.input 指定多个文件入口时,生成的多个html中css加载顺序不一致 #17449

Closed
7 tasks done
gitsheny opened this issue Jun 12, 2024 · 2 comments
Closed
7 tasks done
Labels
duplicate This issue or pull request already exists

Comments

@gitsheny
Copy link

Describe the bug

我在main.js中引入了项目内的css,与第三方UI库的css。
在配置文件中,把编译后的文件按包名拆分,并且配置了两个文件入口。

以下是我的vite.config,js配置

  build: {
    rollupOptions: {
      input: {
        index: 'index.html',
        outside: 'outside.html',
      },
      output: {
        manualChunks(id) {
          if (id.includes('node_modules')) {
            return id.toString().split('node_modules/')[1].split('/')[0].toString()
          }
        },
      },
    },
  },

最终编译后的两个html中,加载css顺序不一致

Reproduction

https://stackblitz.com/edit/vitejs-vite-wh9fkq?file=dist%2Findex.html

Steps to reproduce

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 12th Gen Intel(R) Core(TM) i3-12100
    Memory: 2.44 GB / 15.59 GB
  Binaries:
    Node: 20.14.0 - D:\nvm\nodejs\node.EXE
    npm: 10.7.0 - D:\nvm\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (125.0.2535.67)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @vitejs/plugin-vue: ^5.0.4 => 5.0.5
    vite: ^5.2.0 => 5.2.13

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented Jun 12, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red
Copy link
Member

Duplicate of #6375

@sapphi-red sapphi-red marked this as a duplicate of #6375 Jun 17, 2024
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Jun 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants