
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
@brillout/vite-plugin-import-build
Advanced tools
- [What is this?](#what-is-this) - [Manual import](#manual-import) - [What it does](#what-it-does)
@brillout/vite-plugin-import-build
automatically loads your server build (i.e. your files at dist/server/
).
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-import-build
is able to automatically import your server build (i.e. your files at dist/server/
) — there is nothing for you to do.
But @brillout/vite-plugin-import-build
doesn't work if you use Yarn PnP and you'll keep getting following error. The workaround is to manually import your server build.
# Yarn PnP users always get this error:
[@brillout/vite-plugin-import-build][Wrong Usage] Cannot find server build. (Re-)build your app
and try again. If you still get this error, then you may need to manually import the server build.
[!WARNING] If you aren't using Yarn PnP and you keep getting this error, then it's a bug that should be fixed — please open a new issue.
To manually import your server build:
// server.js
// Load server build, see https://github.com/brillout/vite-plugin-import-build#manual-import
import './path/to/dist/server/importBuild.cjs'
// Your server code (Express.js, Vercel Serverless/Edge Function, Cloudflare Worker, ...)
// ...
Make sure to import dist/server/importBuild.cjs
only in production. See Conditional manual import if your production and development share the same server entry file.
If you use vite.config.js
> build.outDir
then replace dist/server/importBuild.cjs
with ${build.outDir}/server/importBuild.cjs
.
[!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-import-build
does two things:
dist/server/importBuild.cjs
.node_modules/@brillout/vite-plugin-import-build/dist/autoImporter.js
.The import build file (dist/server/importBuild.cjs
) enables tools, such as Vike and Telefunc, to consolidate their server entry file into a single entry file at dist/server/importBuild.cjs
. We recommend having a quick look at the content of dist/server/importBuild.cjs
: you'll see that it essentially loads built user files that live inside dist/server/
(e.g. for Telefunc transpiled .telefunc.js
user files, and for Vike transpiled +Page.js
user files).
The auto importer file (node_modules/@brillout/vite-plugin-import-build/dist/autoImporter.js
) automatically imports dist/server/importBuild.cjs
, so that the user doesn't have to manually import dist/server/importBuild.cjs
himself as shown in the following. That's the only purpose of the auto importer.
// server/index.js (the user's server entry file)
// Without the auto importer, the user would have to manually import dist/server/importBuild.cjs
// in his server entry file like this:
if (process.env.NODE_ENV === 'production') {
await import('../dist/server/importBuild.cjs')
}
See How the auto importer works to learn more.
FAQs
- [What is this?](#what-is-this) - [Manual import](#manual-import) - [What it does](#what-it-does)
The npm package @brillout/vite-plugin-import-build receives a total of 9,317 weekly downloads. As such, @brillout/vite-plugin-import-build popularity was classified as popular.
We found that @brillout/vite-plugin-import-build demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.