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: remove duplicate createRequire in optimizer #86

Merged

Conversation

hi-ogawa
Copy link

Description

There is duplicate createRequire in playground/ssr-deps/node_modules/.vite/deps_ssr/chunk-B6b7aAQJ.js due to Rolldown's automatic polyfill and Vite's banner.

import { createRequire } from 'module';const require = createRequire(import.meta.url);
import { createRequire } from "module";

//#region rolldown:runtime
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function() {
	return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __require = /* @__PURE__ */ createRequire(import.meta.url);

//#endregion
export { __commonJS, __require };

Current Vite SSR is tolerating this code vitejs#19617, but this gets surfaced when oxc transform rejected this code #85.

I think the banner is redundant now, so just removing it seems fix it.

@hi-ogawa hi-ogawa marked this pull request as ready for review March 10, 2025 06:26
@hi-ogawa hi-ogawa force-pushed the fix-remove-duplicate-createRequire branch from f794787 to bc6ec1b Compare March 10, 2025 07:49
@hi-ogawa hi-ogawa changed the base branch from rolldown-v6 to rolldown-vite March 10, 2025 07:49
@hi-ogawa hi-ogawa force-pushed the fix-remove-duplicate-createRequire branch from bc6ec1b to 235759a Compare March 10, 2025 08:12
@sapphi-red sapphi-red merged commit 9bb994c into vitejs:rolldown-vite Mar 10, 2025
10 of 11 checks passed
@hi-ogawa hi-ogawa deleted the fix-remove-duplicate-createRequire branch March 10, 2025 08:41
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

Successfully merging this pull request may close these issues.

2 participants