4. Package Your Angular Element

Now it is the time to package this thing up!, there is several ways

Build using angular cli:

This will generate the entire app inside dist folder

$ ng build --prod

Build & Bundle it in one file:

To use it anywhere else but this way require some additional pages to use ( concat & fs-extra ) packages.

npm install --save-dev concat fs-extra

Create build-elements.js file inside project root folder:

We will use this file to bundle our generated files inside dist folder into one file and save it inside elements folder.

Add new script into packages.json file:

To use it to build our element.

"build:elements": "ng build --output-hashing none && node build-elements.js"

Use Your Angular Element