Socket
Socket
Sign inDemoInstall

vite-plugin-resolve

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-resolve

Custom resolve code for vite


Version published
Weekly downloads
3.5K
decreased by-28.78%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-resolve

npm package
NPM version NPM Downloads

Install

npm i -D vite-plugin-resolve

Usage

import { defineConfig } from 'vite'
import viteResolve from 'vite-plugin-resolve'

export default defineConfig({
  plugins: [
    viteResolve({
      // use code string
      vue: `const vue = window.Vue; export default vue;`,
      // use nested module and function to return code string
      '@scope/name': () => `const Lib = window.LibraryName; export default Lib;`,
      // use function to return string in electron
      'electron-store': () => `const Store = require('electron-store'); export default Store;`,
    })
  ]
})

How to work

  1. Resolve-module will be generated code into node_modules/.vite-plugin-resolve/xxxx.js
  2. Append an resolve-module into alias
{
  resolve: {
    alias: [
      {
        find: 'vue',
        replacement: 'User/work-directory/node_modules/.vite-plugin-resolve/vue.js',
      },
    ],
  },
}

Keywords

FAQs

Package last updated on 12 Jan 2022

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