简体   繁体   中英

How do I include JavaScript Modules into my Angular-Cli App

I have downloaded the open source library QuillJS as a stand alone project. I have added that folder containing Quill into my Angular Cli app. Based on the Quill Docs, I believe I need to include Quill.js in my scripts for Angular Cli to be able to use the library.

However, Quill uses JavaScript Modules, which I have pulled right from their Git Hub and when my Angular app runs Quill.js errors out with this error:

笔芯导入错误

I know the reference is accurate, but I don't think Angular knows how to handle the references. I am trying to edit the open source code of Quill locally and test my changes, but I can not get my app to compile correctly. What I am missing here?

You have two options:

  1. add the script to your index.html file
  2. Add it in the .angular-cli.json file in apps:[ "scripts: [] ] for example:

    apps: [ "scripts": [ "./Quill/Quill.js" ] ]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM