MMF-FE / vite-plugin-cdn-import

Import modules from CDN with vite plugin
MIT License
201 stars 29 forks source link

Would like to define attributes on demand #24

Closed myst729 closed 1 year ago

myst729 commented 2 years ago

Attributes like crossorigin and integrity are very useful in regards of monitoring. Also would like to have defer or other custom attributes define on demand.

myst729 commented 1 year ago

https://github.com/MMF-FE/vite-plugin-cdn-import/pull/37

joisun commented 1 month ago

Hey, There is a example for set defer attribute:

// ...
  plugins: [
    vue(),
    cdn({
      generateScriptTag: (name, url) => ({ 
        attrs:{
          defer: true
        }
       }),
//...       

The same with async, hope it help anyone in need 😛