Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xsip/ngx-ssr-code-remover

Post processor to remove SSR Code from bundles when served
https://github.com/xsip/ngx-ssr-code-remover

Last synced: 15 days ago
JSON representation

Post processor to remove SSR Code from bundles when served

Awesome Lists containing this project

README

        

# ngx-ssr-code-remover

**ngx-ssr-remover** will post-process your angular bundle in your express server and serve bundles with ssr code removed
![alt text](https://github.com/xsip/ngx-ssr-code-remover/blob/main/preview.png?raw=true)
# Setup
``` npm i git@github.com:xsip/ngx-ssr-code-remover.git```

Your express server should contain the following to lines.

```javascript
...
import {removeSsrCodeV2} from "ngx-ssr-remover";

server.set('view engine', 'html');
server.set('views', browserDistFolder);

// add those two lines to your express server
removeSsrCodeV2.removeServerCode(browserDistFolder);
removeSsrCodeV2.serveJsFromNoSsr(server,browserDistFolder);

server.get('**', express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html',
}));

...
```

To Automatically remove functions using the post-processor, decorate your component functions:

```typescript
...
import {RemoveOnServe} from "ngx-ssr-remover/dist/decorator";

@RemoveOnServe()
test() {
console.log('HI');
}

```

Feel free to write tickets when you encounter some issue.