JSPM

  • Created
  • Published
  • Downloads 11855
  • Score
    100M100P100Q150028F
  • License MIT

Package Exports

  • @brillout/vite-plugin-import-build
  • @brillout/vite-plugin-import-build/index.js
  • @brillout/vite-plugin-import-build/loadServerBuild
  • @brillout/vite-plugin-import-build/loadServerBuild.js
  • @brillout/vite-plugin-import-build/plugin
  • @brillout/vite-plugin-import-build/plugin.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@brillout/vite-plugin-import-build) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Automatically loads your server build. (Your server files built at dist/server/ – or ${build.outDir}/server if you use vite.config.js > build.outDir).

importBuild.cjs

Usually, @brillout/vite-plugin-import-build does everything automagically and you don't have to do anything.

You always get following error? This may happen if you use Yarn PnP (follow the instructions below to make it work), but if you aren't using Yarn PnP then open a new issue – it's a bug that should be fixed.

[@brillout/vite-plugin-import-build][Wrong Usage] Cannot find server build.
(Re-)build your app (`$ vite build`) and try again. If you still get this error,
then you may need to manually import your server build,
see https://github.com/brillout/vite-plugin-import-build#importbuildcjs

But, in some environments, you need to help @brillout/vite-plugin-import-build by adding the following to your server code:

// server.js

// Load server build, see https://github.com/brillout/vite-plugin-import-build#importbuildcjs
import './path/to/dist/server/importBuild.cjs'

// Your server code (e.g. Express.js, Vercel Serverless/Edge, Cloudflare Worker, ...)
// ...

If you use vite.config.js > build.outDir then replace ./path/to/dist/server/importBuild.cjs with ./path/to/${build.outDir}/server/importBuild.cjs.

See https://github.com/brillout/vite-plugin-import-build/issues/4 to learn more about importBuild.cjs and why/when you need to import it.