Skip to content

Commit

Permalink
Fix Next examples (#3175)
Browse files Browse the repository at this point in the history
* update node federation use

* add simple node example

* add simple node example

* add readme

* fix demo start cmds

* update node plugin version

* update nextjs-mf

* add env vars

* fix nextjs issues
  • Loading branch information
ScriptedAlchemy authored Oct 24, 2023
1 parent 7dca60d commit 8a497c5
Show file tree
Hide file tree
Showing 16 changed files with 11,145 additions and 130 deletions.
8 changes: 4 additions & 4 deletions comprehensive-demo-react18/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
],
"version": "0.0.0",
"scripts": {
"start": "concurrently \"lerna run --scope=comprehensive-demo-react18_app* --parallel start\" \"yarn serve\"",
"build": "lerna run --scope=comprehensive-demo-react18_app* build",
"serve": "lerna run --scope=comprehensive-demo-react18_app* --parallel serve",
"clean": "lerna run --scope=comprehensive-demo-react18_app* --parallel clean",
"start": "concurrently \"yarn workspace comprehensive-demo-react18_app-01 start\" \"yarn workspace comprehensive-demo-react18_app-02 start\" \"yarn workspace comprehensive-demo-react18_app-03 start\" \"yarn workspace comprehensive-demo-react18_app-04 start\" \"yarn workspace comprehensive-demo-react18_app-05 start\"",
"build": "concurrently \"yarn workspace comprehensive-demo-react18_app-01 build\" \"yarn workspace comprehensive-demo-react18_app-02 build\" \"yarn workspace comprehensive-demo-react18_app-03 build\" \"yarn workspace comprehensive-demo-react18_app-04 build\" \"yarn workspace comprehensive-demo-react18_app-05 build\"",
"serve": "concurrently \"yarn workspace comprehensive-demo-react18_app-01 serve\" \"yarn workspace comprehensive-demo-react18_app-02 serve\" \"yarn workspace comprehensive-demo-react18_app-03 serve\" \"yarn workspace comprehensive-demo-react18_app-04 serve\" \"yarn workspace comprehensive-demo-react18_app-05 serve\"",
"clean": "concurrently \"yarn workspace comprehensive-demo-react18_app-01 clean\" \"yarn workspace comprehensive-demo-react18_app-02 clean\" \"yarn workspace comprehensive-demo-react18_app-03 clean\" \"yarn workspace comprehensive-demo-react18_app-04 clean\" \"yarn workspace comprehensive-demo-react18_app-05 clean\"",
"e2e:ci": "yarn start & wait-on http-get://localhost:3001/ && npx cypress run --config-file ../cypress/config/cypress.config.ts --config '{\"supportFile\": \"../cypress/support/e2e.ts\"}' --spec \"./e2e/runAll*.cy.ts\" --browser=chrome"
},
"devDependencies": {
Expand Down
8,206 changes: 8,206 additions & 0 deletions different-react-versions/yarn.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions nextjs-ssr/checkout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "rm -rf .next;next dev",
"build": "next build",
"start": "NODE_ENV=production next start"
"dev": "rm -rf .next; NEXT_PRIVATE_LOCAL_WEBPACK=true next dev",
"build": "NEXT_PRIVATE_LOCAL_WEBPACK=true next build",
"start": "NEXT_PRIVATE_LOCAL_WEBPACK=true NODE_ENV=production next start"
},
"dependencies": {
"@module-federation/nextjs-mf": "^7.0.4",
"@module-federation/nextjs-mf": "^8.1.0-canary.1",
"lodash": "4.17.21",
"next": "13.3.0",
"next": "^13.5.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"webpack": "5.80.0"
Expand Down
922 changes: 922 additions & 0 deletions nextjs-ssr/checkout/yarn.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions nextjs-ssr/home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "rm -rf .next; next dev -p 3001",
"build": "next build",
"start": "NODE_ENV=production next start -p 3001"
"dev": "rm -rf .next;NEXT_PRIVATE_LOCAL_WEBPACK=true next dev -p 3001",
"build": "NEXT_PRIVATE_LOCAL_WEBPACK=true next build",
"start": "NEXT_PRIVATE_LOCAL_WEBPACK=true NODE_ENV=production next start -p 3001"
},
"dependencies": {
"@module-federation/nextjs-mf": "^7.0.4",
"@module-federation/nextjs-mf": "^8.1.0-canary.1",
"lodash": "4.17.21",
"next": "13.3.0",
"next": "^13.5.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"webpack": "5.80.0"
Expand Down
922 changes: 922 additions & 0 deletions nextjs-ssr/home/yarn.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions nextjs-ssr/shop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 3002",
"build": "next build",
"start": "NODE_ENV=production next start -p 3002"
"dev": "rm -rf .next; NEXT_PRIVATE_LOCAL_WEBPACK=true next dev -p 3002",
"build": "NEXT_PRIVATE_LOCAL_WEBPACK=true next build",
"start": "NEXT_PRIVATE_LOCAL_WEBPACK=true NODE_ENV=production next start -p 3002"
},
"dependencies": {
"@module-federation/nextjs-mf": "^7.0.4",
"@module-federation/nextjs-mf": "^8.1.0-canary.1",
"lodash": "4.17.21",
"next": "13.3.0",
"next": "^13.5.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"webpack": "5.80.0"
Expand Down
4 changes: 2 additions & 2 deletions nextjs-ssr/shop/pages/shop.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import Head from 'next/head';
import Link from 'next/link';

const productLinks = [
{ href: '/p/1', label: 'Product 1' },
{ href: '/p/2', label: 'Product 2' },
Expand Down Expand Up @@ -51,7 +50,8 @@ const Shop = props => (
`}</style>
</div>
);
Shop.getInitialProps = async () => {
export const getServerSideProps = async () => {
console.log('loading slow api')
const swapi = await fetch('https://jsonplaceholder.typicode.com/todos/2').then(res => res.json());
return swapi;
};
Expand Down
Loading

1 comment on commit 8a497c5

@vercel
Copy link

@vercel vercel bot commented on 8a497c5 Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

medusa-example-dsl – ./medusa-example/dsl

medusa-example-dsl.vercel.app
medusa-example-dsl-git-master-module-federation.vercel.app
medusa-example-dsl-module-federation.vercel.app

Please sign in to comment.