Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@brillout/vite-plugin-server-entry
Advanced tools
- [What is this?](#what-is-this) - [Manual import](#manual-import) - [What it does](#what-it-does)
@brillout/vite-plugin-server-entry
generates a server entry dist/server/entry.js
and automatically loads it.
Vike and Telefunc automatically add this plugin to your Vite app: there is nothing for you to do and you can usually ignore this plugin.
Most of the time @brillout/vite-plugin-server-entry
is able to automatically import the server entry dist/server/entry.js
— there is nothing for you to do.
But @brillout/vite-plugin-server-entry
doesn't work if you use Yarn PnP and you'll keep getting following error. The workaround is to manually import the server entry.
# Yarn PnP users always get this error:
[@brillout/vite-plugin-server-entry][Wrong Usage] Cannot find server entry. (Re-)build your app
and try again. If you still get this error, then you may need to manually import the server entry.
[!WARNING] If you aren't using Yarn PnP and you keep getting this error, then it's a bug that should be fixed — file a bug report.
To manually import the server entry:
// server.js
// Load the server entry, see https://github.com/brillout/vite-plugin-server-entry#manual-import
import './path/to/dist/server/entry.js'
// Your server code (Express.js, Vercel Serverless/Edge Function, Cloudflare Worker, ...)
// ...
Make sure to import dist/server/entry.js
only in production. See Conditional manual import if your production and development share the same server.
If the file extension is entry.mjs
, import accordingly:
- import './path/to/dist/server/entry.js
+ import './path/to/dist/server/entry.mjs
If you use vite.config.js
> build.outDir
then replace dist/server/entry.js
with ${build.outDir}/server/entry.js
.
[!NOTE] This section is meant for library authors. As a user, you don't need to read this. If you have a problem, read Manual import instead or reach out to maintainers.
@brillout/vite-plugin-server-entry
does two things:
dist/server/entry.js
.node_modules/@brillout/vite-plugin-server-entry/dist/importServerEntry/autoImporter.js
.The server entry (dist/server/entry.js
) enables tools, such as Vike and Telefunc, to consolidate their entry files into a single file. It enables tools to load built user files (e.g. for Telefunc built .telefunc.js
user files, and for Vike built +Page.js
user files).
The auto importer file (node_modules/@brillout/vite-plugin-server-entry/dist/importServerEntry/autoImporter.js
) automatically imports dist/server/entry.js
, so that the user doesn't have to manually import dist/server/entry.js
himself as shown in the following. That's the only purpose of the auto importer.
// server/index.js (the user's server file)
// Without the auto importer, the user would have to manually import dist/server/entry.js
// in his server entry file like this:
if (process.env.NODE_ENV === 'production') {
await import('../dist/server/entry.js')
}
See How the auto importer works to learn more.
FAQs
- [What is this?](#what-is-this) - [Manual import](#manual-import) - [How it works](#how-it-works)
The npm package @brillout/vite-plugin-server-entry receives a total of 28,130 weekly downloads. As such, @brillout/vite-plugin-server-entry popularity was classified as popular.
We found that @brillout/vite-plugin-server-entry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.