Adds a tutorial project under nx-dev The tutorials are run in browser and can be accessed here: [/tutorials](https://nx-dev-git-nx-dev-tutorialkit-nrwl.vercel.app/tutorials) The tutorials include: - TypeScript Packages - React Monorepo - Angular Monorepo In the future, we will link directly from the sidebar to the in-browser tutorials.
68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
// nx-ignore-next-line
|
|
const { withNx } = require('@nx/next/plugins/with-nx');
|
|
const redirectRules = require('./redirect-rules');
|
|
|
|
module.exports = withNx({
|
|
// Disable the type checking for now, we need to resolve the issues first.
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
// For both client and server
|
|
env: {
|
|
VERCEL: process.env.VERCEL,
|
|
},
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/tutorials/:path*',
|
|
headers: [
|
|
{ key: 'Cross-Origin-Embedder-Policy', value: 'require-corp' },
|
|
{ key: 'Cross-Origin-Opener-Policy', value: 'same-origin' },
|
|
],
|
|
},
|
|
{
|
|
source: '/:path*',
|
|
headers: [
|
|
{ key: 'X-DNS-Prefetch-Control', value: 'on' },
|
|
{
|
|
key: 'Strict-Transport-Security',
|
|
value: 'max-age=63072000; includeSubDomains; preload',
|
|
},
|
|
{ key: 'X-XSS-Protection', value: '1; mode=block' },
|
|
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
|
{ key: 'X-Frame-Options', value: 'DENY' },
|
|
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
|
|
],
|
|
},
|
|
];
|
|
},
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: '/tutorials/:path*',
|
|
destination: '/tutorials/:path*/index.html',
|
|
},
|
|
{
|
|
source: '/tutorials',
|
|
destination: '/tutorials/index.html',
|
|
},
|
|
];
|
|
},
|
|
async redirects() {
|
|
const rules = [];
|
|
|
|
// Apply all the redirects from the redirect-rules.js file
|
|
for (const section of Object.keys(redirectRules)) {
|
|
for (const source of Object.keys(redirectRules[section])) {
|
|
rules.push({
|
|
source: source,
|
|
destination: redirectRules[section][source],
|
|
permanent: true,
|
|
});
|
|
}
|
|
}
|
|
|
|
return rules;
|
|
},
|
|
});
|