Create code snippets, part 4
See original GitHub issueDescription
Create code snippets to replace the following inline code blocks.
<code-example language="json" header="angular.json">
{
"projects": {
"my-existing-project": {
"architect": {
"build": {
"options": {
...
"aot": true,
}
}
}
}
}
}
</code-example>
<code-example language="json" header="package.json">
{
"scripts": {
"postinstall": "ngcc"
}
}
</code-example>
<code-example language="json" header="tsconfig.app.json">
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"angularCompilerOptions": {
"enableIvy": false
}
}
</code-example>
<code-example language="typescript" header="polyfills.ts">
/***************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
</code-example>
<code-example language="typescript" header="server.ts">
import 'zone.js/node';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { join } from 'path';
import { APP_BASE_HREF } from '@angular/common';
import { AppServerModuleNgFactory } from './src/app/app.server.module.ngfactory';
// The Express app is exported so that it can be used by serverless Functions.
export function app() {
const server = express();
const distFolder = join(process.cwd(), 'dist/ivy-test/browser');
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
server.engine('html', ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
}));
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// app.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
// All regular routes use the Universal engine
server.get('*', (req, res) => {
res.render('index', { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] });
});
return server;
}
function run() {
const port = process.env.PORT || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
if (mainModule && mainModule.filename === __filename) {
run();
}
export * from './src/main.server';
</code-example>
What is the affected URL?
guide/ivy
Please provide the steps to reproduce the issue
Current deprecations topic includes multiple inline code blocks.
Please provide the expected behavior vs the actual behavior you encountered
Create new code snippets for each inline code block.
Please provide a screenshot if possible
n/a
Please provide the exception or error you saw
n/a
Is this a browser-specific issue? If so, please specify the device, browser, and version.
n/a
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Walkthrough: Create a code snippet - Visual Studio (Windows)
The Import Code Snippet dialog opens, asking you to choose where to add the snippet from the choices in the right pane. One...
Read more >Snippets in Visual Studio Code
Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements. In Visual Studio Code, snippets...
Read more >How to Create Your Own Custom Code Snippets Right in Your ...
A code Snippet is a programming term that refers to a small portion of re-usable source code, machine code, or text.
Read more >IP-logger - Part 4: Adding cronjob to crontab - Google Sites
Joen's code snippets pages ... IP-logger - Part 4: Adding cronjob to crontab ... IP-logger - Part 1: Create a Pushbullet account and...
Read more >Code Snippets – WordPress plugin
Code Snippets changes that by providing a GUI interface for adding snippets and actually running them on your site just as if they...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The ivy guide was removed recently: https://github.com/angular/angular/commit/4ed8dc858aebfdf0ab271ec8c710e60f3d10058a
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.