Search code examples
javascriptangularnode-modulesprimengprimeng-calendar

Manually load in node module that I have customised (Angular 4.x)


I am using the primeng Calender functionality in my Angular 4.x app - however I have had to make lots of customisations to the plugin that I need to save within our repo however currently this file lives within node_modules which we do not save to our repos (but run npm install to install the dependencies) https://www.primefaces.org/primeng/#/calendar

I have tried to reference this within my tsconfig.app.json but I am obviously doing something wrong as this - what is the best approach to moving stuff from node_modules into my src app?

{
  "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"
  ]
}

Solution

  • I ran into the same issue with ckeditor, below is the modification I made to include a customized version of ckeditor in my build. I am sure there are other ways but this worked for me.

    • This will output into the assets folder and you will need to deploy the assets folder to your production server when doing a patch or update to the module.
    • modification to angular-cli.json

      "assets": [
              "assets",
              { "glob": "**/*", "input": "../direcotryOutsideOfNode_Modules/ckeditor", "output": "./assets/scripts/ckeditor/" }
            ],
      

    Then in your index.html add it as a script tag

    <script src="./assets/scripts/ckeditor/ckeditor.js"></script>