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

fix(build): build project path error #9793

Merged
merged 4 commits into from Aug 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/vite/src/node/build.ts
Expand Up @@ -372,12 +372,14 @@ async function doBuild(
)

const resolve = (p: string) => path.resolve(config.root, p)
const input = libOptions
let input = libOptions
? resolve(libOptions.entry)
: typeof options.ssr === 'string'
? resolve(options.ssr)
: options.rollupOptions?.input || resolve('index.html')

if (input === 'index.html') {
input = resolve(input)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have a particular case for index.html. This will be still broken for foo.html. We need to check where input is being used which results in the paths being different on both platforms. Probably in the html plugin, when computing these paths. I think we may be missing a normalizePath. https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/html.ts#L929

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks for the explanation

if (ssr && typeof input === 'string' && input.endsWith('.html')) {
throw new Error(
`rollupOptions.input should not be an html file when building for SSR. ` +
Expand Down