简体   繁体   中英

Angular 2 include dependencies from node_modules into index.html

Is it possible to include dependencies from node_modules in index.html? I have tried to achieve this by putting the following in my head tag:

<script src="../node_modules/systemjs/dist/system.src.js"></script>

Unfortunately, I get an error in my console which states that it could not be found:

GET http://localhost:4200/node_modules/systemjs/dist/system.src.js

Any suggestions?

Knowing other web servers the '..' is accessing outside the published path, any web server is allowed to share. Otherwise one may inspect your server environment with this '..' trick.

Try to copy the system.js or system.src.js (may be slower) to a static path within in the reach of index.html, eg static/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