我在我的 Angular 4.x 应用程序中使用 primeng Calender 功能 - 但是我必须对需要保存在我们的存储库中的插件进行大量自定义,但目前该文件位于 node_modules
我们不会将其保存到我们的存储库中(但运行 npm install
来安装依赖项)
https://www.primefaces.org/primeng/#/calendar
我试图在我的 tsconfig.app.json 中引用它,但我显然做错了一些事情 - 将内容从 node_modules 移动到我的 src
应用程序中的最佳方法是什么?
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": ["underscore"]
},
"include": [
"/src/assets/css/primeng/components/calendar/calendar.js"
],
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
最佳答案
我在使用 ckeditor 时遇到了同样的问题,下面是我为在构建中包含 ckeditor 的自定义版本而进行的修改。我确信还有其他方法,但这对我有用。
- 这将输出到 Assets 文件夹中,您在对模块进行修补或更新时需要将 Assets 文件夹部署到生产服务器。
修改 angular-cli.json
"assets": [ "assets", { "glob": "**/*", "input": "../direcotryOutsideOfNode_Modules/ckeditor", "output": "./assets/scripts/ckeditor/" } ],
然后在你的index.html中将其添加为脚本标签
<script src="./assets/scripts/ckeditor/ckeditor.js"></script>
关于javascript - 手动加载我自定义的节点模块(Angular 4.x),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53009813/