Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-node

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-node

Vite as Node runtime

  • 0.1.7
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is vite-node?

The vite-node package is a tool that allows you to run Node.js scripts with Vite's native ES modules support, providing features such as hot module replacement (HMR) and TypeScript support out of the box. It is designed to work with Vite's ecosystem and can be used for tasks like server-side rendering (SSR) and testing.

What are vite-node's main functionalities?

Running Node.js scripts with ES modules

This feature allows you to run Node.js scripts that use ES module syntax, leveraging Vite's module resolution and transformation capabilities.

import { createServer } from 'vite-node/server';

const server = createServer({
  // Vite's options here
});

server.moduleGraph.ensureEntryFromUrl('/path/to/your/module.js');

Hot Module Replacement (HMR)

vite-node supports HMR, enabling developers to have a more interactive development experience by automatically reloading modules when changes are detected.

import { createServer } from 'vite-node/server';

const server = createServer({
  // Vite's options here
});

server.watcher.on('change', (file) => {
  server.moduleGraph.invalidateModule(file);
});

TypeScript support

With vite-node, you can run TypeScript files directly without pre-compilation, as it integrates with Vite's built-in TypeScript support.

import { createServer } from 'vite-node/server';

const server = createServer({
  // Vite's options here
});

server.moduleGraph.ensureEntryFromUrl('/path/to/your/typescript-module.ts');

Other packages similar to vite-node

Keywords

FAQs

Package last updated on 03 Dec 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc