-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from strenuus/mf
Add module federation plugin
- Loading branch information
Showing
25 changed files
with
2,622 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.DS_Store | ||
.bin | ||
.git | ||
.gitignore | ||
.gitattributes | ||
.bundleignore | ||
.bundle | ||
.byebug_history | ||
.rspec | ||
.cache | ||
public | ||
tmp | ||
log | ||
test | ||
node_modules | ||
node_modules/ | ||
yarn-error.log | ||
coverage/ | ||
db_data/ | ||
docker/ | ||
docker-compose.yml | ||
*.vim | ||
.env | ||
.env.* | ||
.nvmrc | ||
.tool-versions | ||
.envrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// @ts-check | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const { dependencies: deps } = require("../package.json") | ||
|
||
const hostUrl = new URL( | ||
"packs/remoteEntry.js", | ||
process.env.HOST_CONTAINER_URL || "http://network360-webpacker-1:3035" | ||
) | ||
|
||
/** @satisfies {import("@module-federation/typescript/src/types").ModuleFederationPluginOptions} */ | ||
const config = { | ||
name: "cms", | ||
filename: "remoteEntry.js", | ||
remotes: { | ||
host: `host@${hostUrl}`, | ||
}, | ||
shared: { | ||
...deps, | ||
react: { singleton: true, requiredVersion: deps.react }, | ||
"react-dom": { singleton: true, requiredVersion: deps["react-dom"] }, | ||
}, | ||
} | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// @ts-check | ||
const HtmlWebpackPlugin = require("html-webpack-plugin") | ||
const path = require("path") | ||
const { ModuleFederationPlugin } = require("webpack").container | ||
const federationConfig = require("./federation") | ||
|
||
/** @typedef {import("webpack").Configuration} Configuration */ | ||
/** @satisfies {Configuration} */ | ||
const config = { | ||
entry: {}, | ||
output: { | ||
path: path.resolve(__dirname, "./public"), | ||
}, | ||
resolve: { | ||
extensions: [".js", ".jsx", ".ts", ".tsx", ".json", ".wasm"], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(jsx?|tsx?)$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: "ts-loader", | ||
}, | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ template: "./public/index.html" }), | ||
new ModuleFederationPlugin({ | ||
...federationConfig, | ||
}), | ||
], | ||
} | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
title: FAQ | ||
description: Frequently asked questions | ||
subtopics: | ||
- subtopic: general | ||
questions: | ||
- question: How do I edit my profile picture? | ||
answer: You can't, haha! | ||
- subtopic: modules | ||
questions: | ||
- question: Module A | ||
answer: Answer about Module A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: "3" | ||
services: | ||
web: | ||
build: | ||
context: . | ||
dockerfile: docker/Dockerfile | ||
target: web | ||
command: npx gatsby develop -H 0.0.0.0 | ||
ports: | ||
- "8000:8000" | ||
networks: | ||
zna-mf: | ||
aliases: | ||
- network360.local | ||
- cms.network360.local | ||
healthcheck: | ||
test: curl --fail localhost:8000/admin/config.yml || exit 1 | ||
interval: 30s | ||
timeout: 5s | ||
retries: 10 | ||
restart: on-failure | ||
|
||
proxy: | ||
build: | ||
context: . | ||
dockerfile: docker/Dockerfile | ||
target: proxy | ||
command: npx decap-server | ||
ports: | ||
- "8081:8081" | ||
networks: | ||
zna-mf: {} | ||
restart: on-failure | ||
|
||
networks: | ||
zna-mf: | ||
name: zna-mf | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:20 AS build | ||
WORKDIR /app | ||
COPY package*.json . | ||
RUN npm install | ||
COPY . . | ||
|
||
FROM build AS web | ||
EXPOSE 8000 | ||
|
||
FROM build AS proxy | ||
EXPOSE 8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.