I've placed your script in the public folder, which is a replacement for the assets folder in newer Angular versions. Also, I renamed the resulting main.js file to custom-element.js to avoid name collision.
public
main.js
custom-element.js