Office hour questions about including libraries
LittleAprilFool opened this issue · comments
April commented
1. Snapsvg
Issue
- install snapsvg by
npm install snapsvg
- include snapsvg by
import Snap from "snapsvg"
(the instructions on npm site are out-dated) - get error
Uncaught TypeError: Cannot read property 'on' of undefined
Related Discussions
Solution
- use
snapsvg-cjs
April commented
2. Fontawesome
Issue
- install fontawesome by
npm install @fortawesome/fontawesome-free
, following instructions here - the instructions are not clear
Solution
If students are using Fontawesome, they can just use CDN to reference it, no need to bundle it with webpack
April commented
3. NPM couldn't install any packages
Issue
A common issue that students located in China would encounter: https://registry.npmjs.org/ is blocked by the GFW — even if they turn on the VPN, npm install wouldn’t install through the VPN and they will get npm install Error: rollbackFailedOptional.
Solution
Use a mirror site of npmjs hosted in China. For example, run npm config set registry http://registry.npm.taobao.org