New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-esmodule

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-esmodule - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "vite-plugin-esmodule",
"version": "1.0.0",
"version": "1.0.1",
"description": "Build ES module to CommonJs module for Node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,2 +18,6 @@ [![npm package](https://nodei.co/npm/vite-plugin-esmodule.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vite-plugin-esmodule)

Take execa and node fetch as examples
- vite.config.js
```js

@@ -31,1 +35,35 @@ import esmodule from 'vite-plugin-esmodule'

```
- execa.js
```js
import {execa} from 'execa';
const {stdout} = await execa('echo', ['unicorns']);
console.log(stdout);
//=> 'unicorns'
```
- node-fetch.js
```js
import fetch from 'node-fetch';
const response = await fetch('https://github.com/');
const body = await response.text();
console.log(body);
```
See the test [cases](https://github.com/caoxiemeihao/vite-plugins/tree/main/playground/vite-plugin-esmodule)
## API
#### esmodule(modules: string[])
modules: ES module name list
## How to work
The plugin will use the `build` API of Vite to build ES module into the `node_modules/.vite-plugin-esmodule` directory
Then point to the built path by modifying `resolve.alias`
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