Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
vite-plugin-esmodule
Advanced tools
Build ES module to CommonJs module for Node.js/Electron
When using ES modules(e.g.node-fetch
) in Node.js/Electron projects, we may need to compile them into CommonJs modules to ensure they work correctly.
在 Node.js/Electron 项目中使用 ES 模块时(e.g. node-fetch
),我们可能需要将其编译成 CommonJs 模块,以确保它们能够正常工作
npm i -D vite-plugin-esmodule webpack
vite.config.js
import esmodule from 'vite-plugin-esmodule'
export default {
plugins: [
// Take `execa`, `node-fetch` and `file-type` as examples
esmodule([
'execa',
'node-fetch',
// 🌱 this means that you have explicit specified the entry file
{ 'file-type': 'file-type/index.js' },
]),
],
}
execa.js
import {execa} from 'execa';
const {stdout} = await execa('echo', ['unicorns']);
console.log(stdout);
//=> 'unicorns'
esmodule(modules[, webpack])
import type { Configuration } from 'webpack'
type ModuleRecord = string | { [module: string]: string }
function esmodule(
modules: ModuleRecord[] | ((esmPkgs: string[]) => ModuleRecord[]),
webpack?: ((config: Configuration) => Configuration | void | Promise<Configuration | void>),
): import('vite').Plugin
This plugin just wraps vite-plugin-optimizer
[2023-05-13] v1.5.0
webpack
versionFAQs
Build ES module to CommonJs module for Node.js/Electron
The npm package vite-plugin-esmodule receives a total of 1,898 weekly downloads. As such, vite-plugin-esmodule popularity was classified as popular.
We found that vite-plugin-esmodule demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.