nuxt-community / fontawesome-module

Module to use Font Awesome icons in Nuxt.js
MIT License
110 stars 12 forks source link

Any examples of configuration using self-hosted packages? #23

Closed seandan7 closed 3 years ago

seandan7 commented 3 years ago

Are there any examples or suggestions for the nuxt.config setup if using self-hosted fontAwesome packages? I noticed that if purchasing a pro license and not renewing, the icons will no longer be available via .npmrc and the app will break.

Is there any known solution for this?

pimlie commented 3 years ago

@seandan7 Maybe a webpack alias could work?

seandan7 commented 3 years ago

@pimlie That worked swimmingly!

vakrolme commented 2 years ago

@seandan7, could you please share your config for how you did it?

seandan7 commented 2 years ago

@vakrolme I don't work where I used this code anymore. I should have commented it here.

I believe it was something like this: nuxt.config.js

module.exports = {
    build: {
        extend (config) {
            config.resolve.alias['@fontawesome']= path.join(this.options.srcDir, 'fontawesome-local')
        }
    }
}

With all of your local downloaded files in that directory.

vakrolme commented 2 years ago

Thanks @seandan7. I used nuxt's own alias property instead:

import { resolve } from 'path';
export default {
  ...
  alias: {
    '@fortawesome/free-regular-svg-icons': resolve(__dirname, 'assets/icons/fontawesome-local/free-regular-svg-icons'),
  },
  ...
}

It's also important not to confuse which type of distribution you should put there, it should be js-packages, not js, so the directory you point to must feature index.js and a separate file for each icon, rather than all.js. That's why nothing worked for me until I figured it out.