Customise ionic component in node_modules

I have customised 2 or 3 components to suite my needs within node_modules/ionic-angular/components/

when i do a dev build the changes are present and work great

but when i do a --prod build the changes are not present.

I’ve looked inside the build scripts but cant seem to understand why this is the case?!

This is a really unsustainable and bad idea. Can you achieve your goal by wrapping the ionic components in a custom component in your ordinary app src directory?

Thanks for the reply, I understand it’s unsustainable I created a script to copy my edited modules into node_modules for whenever i update, which is annoying at best…

ok, So create a component that extends Scroll for example.

What i’ve done is added a ion-fixed capabilites to scroll, so i can have fixed elements in a scroll container not just content.

I’ve changed it to this

Scroll.decorators = [
    { type: Component, args: [{
                selector: 'ion-scroll',
                template: '<div class="fixed-content">' +
                '<ng-content select="[ion-fixed]"></ng-content>' +
            '</div>' + 
            '<div class="scroll-content" #scrollContent>' +
            '<div class="scroll-zoom-wrapper">' +
            '<ng-content></ng-content>' +
            '</div>' +
                host: {
                    '[class.scroll-x]': 'scrollX',
                    '[class.scroll-y]': 'scrollY'
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
            },] },

Is this possible to overwrite the decorators in a Typescript extend?

doh, i can just copy and call it something else!

Thanks for guidance, This should make my project a lot cleaner! :smile:

Although in some scenarios it would be good to overwrite a class, like the Alert Class, I want to modify it slightly but cant use the method above as it would need to be named the same as it’s used by a number of ionic classes, so short of duplicating and renaming the options, controller, and Alert class. can i just overwrite Alert?