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: inject instead of auto import server entry #8

Merged
merged 19 commits into from
Aug 23, 2024
Merged

Conversation

brillout
Copy link
Member

Please squash all (wip) commits.

I ain't sure how the CI failure can be related to my changes, but I'll have a look.

@brillout
Copy link
Member Author

Note how examples/express-react/dist/server/entry.mjs is removed: it's now injected into examples/express-react/dist/server/index.mjs.

As a bonus, the autoImporter brittle hack isn't used at all:

// node_modules/.pnpm/@brillout+vite-plugin-server-entry@0.4.9/node_modules/@brillout/vite-plugin-server-entry/dist/importServerEntry/autoImporter.js
exports.status = 'DISABLED_BY_INJECT';

@brillout
Copy link
Member Author

I ain't sure how the CI failure can be related to my changes, but I'll have a look.

The issue seems to be that Rollup calls closeBundle() without calling writeBundle(), which is surprising and contradicts Rollup's hook graph.

Let me have a look at what causes Rollup to behave like this. (It's something in vite-plugin-server-entry as removing config.vitePluginServerEntry.inject = Object.keys(resolvedEntries) fixes the issue.)

@brillout
Copy link
Member Author

Let me have a look at what causes Rollup to behave like this. (It's something in vite-plugin-server-entry as removing config.vitePluginServerEntry.inject = Object.keys(resolvedEntries) fixes the issue.)

Ok, that's expected: in inject mode vite-plugin-server-entry doesn't add any rollupOptions.input and, consequently, there isn't any Rollup entry and writeBundle() isn't called. I pushed a fix for this.

@brillout
Copy link
Member Author

The CI is still red, I'm aware with that error - let me have a look.

brillout added a commit to vikejs/vike that referenced this pull request Aug 23, 2024
brillout added a commit to vikejs/vike that referenced this pull request Aug 23, 2024
@brillout
Copy link
Member Author

The CI is still red, I'm aware with that error - let me have a look.

Fixed. The CI is now green.

@nitedani nitedani merged commit 15eccda into main Aug 23, 2024
4 checks passed
@nitedani nitedani deleted the brillout/dev branch August 23, 2024 23:04
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