Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: one file build #181

Open
wants to merge 14 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/next-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
echo "{\"latestTag\": \"$(git rev-parse --short $GITHUB_SHA)\"}" > assets/release.json
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
env:
INLINE_APP_CONFIG_JSON: true
- run: pnpm build-storybook
- name: Copy playground files
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
- name: Write Release Info
run: echo '${{ toJson(steps.releaseInfo.outputs) }}' > assets/release.json
- run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
env:
INLINE_APP_CONFIG_JSON: true
- run: pnpm build-storybook
- name: Copy playground files
run: |
Expand Down
4 changes: 0 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@
}
</script> -->
<title>Prismarine Web Client</title>
<link rel="favicon" href="favicon.png">
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="canonical" href="https://mcraft.fun">
<meta name="description" content="Minecraft web client running in your browser">
<meta name="keywords" content="Play, Minecraft, Online, Web, Java, Server, Single player, Javascript, PrismarineJS, Voxel, WebGL, Three.js">
Expand All @@ -106,9 +104,7 @@
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover'>
<meta property="og:title" content="Prismarine Web Client" />
<meta property="og:type" content="website" />
<meta property="og:image" content="favicon.png" />
<meta name="format-detection" content="telephone=no">
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
</head>
<body>
<div id="react-root"></div>
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"start": "run-p dev-rsbuild dev-proxy watch-mesher",
"build": "pnpm build-other-workers && rsbuild build",
"build-analyze": "BUNDLE_ANALYZE=true rsbuild build && pnpm build-other-workers",
"build-single-file": "SINGLE_FILE_BUILD=true rsbuild build",
"check-build": "tsx scripts/genShims.ts && tsc && pnpm build",
"test:cypress": "cypress run",
"test-unit": "vitest",
Expand Down Expand Up @@ -164,6 +165,9 @@
"cypress-plugin-snapshots": "^1.4.4",
"systeminformation": "^5.21.22"
},
"release": {
"attachReleaseFiles": "dist/minecraft.html"
},
"pnpm": {
"overrides": {
"buffer": "^6.0.3",
Expand Down
14 changes: 13 additions & 1 deletion prismarine-viewer/rsbuildSharedConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export const rspackViewerConfig = (config, { appendPlugins, addRules, rspack }:
if (absolute.endsWith('/minecraft-data/data.js')) {
resource.request = path.join(__dirname, `../src/shims/minecraftData.ts`)
}
if (absolute.endsWith('/minecraft-data/data/bedrock/common/legacy.json')) {
resource.request = path.join(__dirname, `../src/shims/empty.ts`)
}
if (absolute.endsWith('/minecraft-data/data/pc/common/legacy.json')) {
resource.request = path.join(__dirname, `../src/preflatMap.json`)
}
}))
addRules([
{
Expand All @@ -91,11 +97,17 @@ export const rspackViewerConfig = (config, { appendPlugins, addRules, rspack }:
{
test: /\.mp3$/,
type: 'asset/source',
},
{
test: /\.txt$/,
type: 'asset/source',
}
])
config.ignoreWarnings = [
/the request of a dependency is an expression/,
/Unsupported pseudo class or element: xr-overlay/
]

if (process.env.SINGLE_FILE_BUILD === 'true') {
config.module!.parser!.javascript!.dynamicImportMode = 'eager'
}
}
Loading