透過超過 100 個秘訣來學習 Nuxt!

nupolyon

從 polyfill.io 注入 polyfill 到 Nuxt 專案,根據 browserslist 配置自動偵測

Nupolyon

npm versionnpm downloadsLicense

https://cdnjs.cloudflare.com/polyfill/ 自動注入 polyfill

⚠️ 警告

請勿使用此模組,POLYFILL.IO 已被報告注入惡意程式碼。暫時我們將 URL 移至 Cloudflare 的鏡像。

https://www.bleepingcomputer.com/news/security/polyfillio-javascript-supply-chain-attack-impacts-over-100k-sites/

https://sansec.io/research/polyfill-supply-chain-attack

https://www.theregister.com/2024/06/25/polyfillio_china_crisis/

https://www.scmagazine.com/brief/over-100k-sites-hit-by-polyfill-io-supply-chain-attack

功能

請在此處查看詳細的功能說明: #58 (評論)

快速設定

  1. 新增 nupolyon 依賴到您的專案
npx nuxi@latest module add nupolyon
  1. 新增 nupolyonnuxt.config.tsmodules 區段
export default defineNuxtConfig({
  modules: [
    'nupolyon'
  ]
})

就是這樣!您現在可以在您的 Nuxt 應用程式中使用 Nupolyon ✨

設定

export default defineNuxtConfig({
  modules: [
    'nupolyon'
  ],
  nupolyon: {
    // change host
    host: 'http://my-own-cdn.com/polyfill.min.js'
    // or enable self-host mode
    host: 'selfhost'

    // customize browserslist's target
    target: 'defaults'
  },
})

開發

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

授權條款

此專案以 MIT 授權條款發布,詳情請參閱 LICENSE