
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
vite-plugin-path-resolve
Advanced tools
这个plugin主要是解决 vue2 + webpack 迁移至 vite 中的路径问题.
case1: src/demo1/index.vue
case2: src/demo2/index.js
case3: src/demo3.vue
这在webpack是没问题的, 但是vite的话就会报错. 因为这个路径找不到对应文件
// ❌ in vite ,👌 in webpack
import demo1 from 'src/demo1'
import demo2 from 'src/demo2'
import demo3 from 'src/demo3'
to
// 🙆
import demo1 from 'src/demo1/index.vue'
import demo2 from 'src/demo2/index.js'
import demo3 from 'src/demo3.vue'
$ npm i vite-plugin-path-resolve -D
// vite.config.js
import pathResolve from 'vite-plugin-path-resolve'
function getPath(dir) {
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), dir)
}
export default defineConfig({
plugins: [
pathResolve({ src: getPath('src') }),
]
})
Name | Description | Default |
---|---|---|
Object | required 需要处理的绝对路径对象集合 | null |
传入这个对象, 这个plugin将会只处理这个路径集合下的文件
请务必注意要绝对路径
FAQs
vite-plugin-path-resolve
We found that vite-plugin-path-resolve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.