1 | # Upgrading Guide
|
2 |
|
3 | See the [CHANGELOG.md](./CHANGELOG.md) for detailed information about what has changed between versions.
|
4 |
|
5 | This guide is useful to figure out what you need to do between breaking changes.
|
6 |
|
7 | As always, [submit issues](https://github.com/FortAwesome/vue-fontawesome/issues/new) that you run into with this guide or with these upgrades to us.
|
8 |
|
9 | ## 0.0.x to 0.1.0
|
10 |
|
11 | ### Renamed packages
|
12 |
|
13 | The following packages have been renamed as part of 5.1.0 of Font Awesome.
|
14 |
|
15 | _All packages are in the [@fortawesome NPM scope](https://www.npmjs.com/search?q=scope:fortawesome&page=1&ranking=optimal)_
|
16 |
|
17 | | Old package(1) | New package |
|
18 | |--------------------------|------------------------|
|
19 | | fontawesome | fontawesome-svg-core |
|
20 | | fontawesome-free-solid | free-solid-svg-icons |
|
21 | | fontawesome-free-regular | free-regular-svg-icons |
|
22 | | fontawesome-free-brands | free-brands-svg-icons |
|
23 | | fontawesome-pro-solid | pro-solid-svg-icons |
|
24 | | fontawesome-pro-regular | pro-regular-svg-icons |
|
25 | | fontawesome-pro-light | pro-light-svg-icons |
|
26 |
|
27 | (1) Old packages have now been deprecated. They are still available but will only receive high priority patch release fixes.
|
28 |
|
29 | **You'll need to update your package.json file with the renamed packages and new versions.**
|
30 |
|
31 | ### No more default imports
|
32 |
|
33 | Recently we spent a good deal of time supporting TypeScript to enable us to
|
34 | create the Angular Font Awesome component. During that adventure we
|
35 | [were](https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html)
|
36 | [convinced](https://blog.neufund.org/why-we-have-banned-default-exports-and-you-should-do-the-same-d51fdc2cf2ad)
|
37 | that we were going to remove default exports from all of our components,
|
38 | libraries, and packages. This is complete with the umbrella release of `5.1.0` of Font Awesome.
|
39 |
|
40 | What does that mean?
|
41 |
|
42 | ~~Old way:~~
|
43 |
|
44 | ```javascript
|
45 | import fontawesome from '@fortawesome/fontawesome'
|
46 | import solid from '@fortawesome/fontawesome-free-solid'
|
47 | import faTwitter from '@fortawesome/fontawesome-free-brands/faTwitter'
|
48 | import FontAwesomeIcon from '@fortawesome/vue-fontawesome'
|
49 |
|
50 | fontawesome.library.add(solid, faTwitter)
|
51 | ```
|
52 |
|
53 | New way:
|
54 |
|
55 | ```javascript
|
56 | import { library } from '@fortawesome/fontawesome-svg-core'
|
57 | import { fas } from '@fortawesome/free-solid-svg-icons'
|
58 | import { faTwitter } from '@fortawesome/free-brands-svg-icons'
|
59 | import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
60 |
|
61 | library.add(fas, faTwitter)
|
62 | ```
|
63 |
|
64 | This is also a valid way to import icons that works if your tool does not support tree shaking:
|
65 |
|
66 | ```javascript
|
67 | import { faTwitter } from '@fortawesome/free-brands-svg-icons/faTwitter'
|
68 | ```
|
69 |
|
70 | ### Improved support for tree shaking
|
71 |
|
72 | Tree shaking is now functional by default and no additional configuration is required to make it work.
|
73 |
|
74 | The `shakable.es.js` module has been removed and is no longer needed.
|
75 |
|
76 | If you've previously configured tree shaking by modifying your webpack or rollup you can safely remove these.
|
77 |
|
78 | **We recommend that you check your bundle size after upgrading an ensure that file sizes are as you would expect.**
|
79 |
|
80 | ```javascript
|
81 | module.exports = {
|
82 | // ...
|
83 | resolve: {
|
84 | alias: {
|
85 | '@fortawesome/fontawesome-free-solid$': '@fortawesome/fontawesome-free-solid/shakable.es.js'
|
86 | }
|
87 | }
|
88 | }
|
89 | ```
|
90 |
|
91 | ```javascript
|
92 | const alias = require('rollup-plugin-alias')
|
93 |
|
94 | rollup({
|
95 | // ...
|
96 | plugins: [
|
97 | alias({
|
98 | '@fortawesome/fontawesome-free-solid': 'node_modules/@fortawesome/fontawesome-free-solid/shakable.es.js'
|
99 | })
|
100 | ]
|
101 | })
|
102 | ```
|
103 |
|
104 | ### Mixed modes with automatic replacement of `<i>` tags to `<svg>`
|
105 |
|
106 | If you were previously relying on Font Awesome to replace any `<i>` tags in
|
107 | your page or app with `<svg>` you'll need to explicitly control that now.
|
108 |
|
109 | ```javascript
|
110 | import { dom } from '@fortawesome/fontawesome-svg-core'
|
111 |
|
112 | dom.watch() // This will kick of the replacement of i tags and configure a MutationObserver
|
113 | ```
|