feat: bugfix for : Problem Temporarily Solved, Not Fix: Error building my application #1414 (#1567)

* V1

## [Unreleased] - 2025-03-28

###  Fixed
- Fixed deployment errors on Cloudflare Pages caused by:
  - Missing or outdated `compatibility_date` and `compatibility_flags` in `wrangler.toml`
  - Use of Node.js built-ins (`crypto`, `stream`) in functions without proper polyfilling
  - Invalid Wrangler CLI options (`--log-level`) used during deployment
  - Type error when importing the Remix server build

### 🛠 Changed
- `wrangler.toml` updated:
  ```toml
  name = "bolt"
  compatibility_date = "2025-03-28"
  compatibility_flags = ["nodejs_compat"]
  pages_build_output_dir = "./build/client"
  send_metrics = false
  ```
- `functions/[[path]].ts` updated:
  ```ts
  import type { ServerBuild } from '@remix-run/cloudflare';
  import { createPagesFunctionHandler } from '@remix-run/cloudflare-pages';
  import * as serverBuild from '../build/server';

  export const onRequest = createPagesFunctionHandler({
    build: serverBuild as unknown as ServerBuild,
  });
  ```

### 🚀 Deployment
- Successful deployment to:
  - Preview: https://979e2ca9.bolt-55b.pages.dev
  - Production: https://main.bolt-55b.pages.dev

* V1

## [Unreleased] - 2025-03-28

###  Fixed
- Fixed deployment errors on Cloudflare Pages caused by:
  - Missing or outdated `compatibility_date` and `compatibility_flags` in `wrangler.toml`
  - Use of Node.js built-ins (`crypto`, `stream`) in functions without proper polyfilling
  - Invalid Wrangler CLI options (`--log-level`) used during deployment
  - Type error when importing the Remix server build

### 🛠 Changed
- `wrangler.toml` updated:
  ```toml
  name = "bolt"
  compatibility_date = "2025-03-28"
  compatibility_flags = ["nodejs_compat"]
  pages_build_output_dir = "./build/client"
  send_metrics = false
  ```
- `functions/[[path]].ts` updated:
  ```ts
  import type { ServerBuild } from '@remix-run/cloudflare';
  import { createPagesFunctionHandler } from '@remix-run/cloudflare-pages';
  import * as serverBuild from '../build/server';

  export const onRequest = createPagesFunctionHandler({
    build: serverBuild as unknown as ServerBuild,
  });
  ```

### 🚀 Deployment
- Successful deployment to:
  - Preview: https://979e2ca9.bolt-55b.pages.dev
  - Production: https://main.bolt-55b.pages.dev

* feat: small bugfix
This commit is contained in:
Stijnus
2025-03-29 10:26:42 +01:00
committed by GitHub
parent 1364d4a503
commit 47444970e8
6 changed files with 659 additions and 204 deletions

View File

@@ -11,7 +11,6 @@ import { join } from 'path';
dotenv.config();
// Get detailed git info with fallbacks
const getGitInfo = () => {
try {
return {
@@ -40,7 +39,6 @@ const getGitInfo = () => {
}
};
// Read package.json with detailed dependency info
const getPackageJson = () => {
try {
const pkgPath = join(process.cwd(), 'package.json');
@@ -89,7 +87,6 @@ export default defineConfig((config) => {
__PKG_DEV_DEPENDENCIES: JSON.stringify(pkg.devDependencies),
__PKG_PEER_DEPENDENCIES: JSON.stringify(pkg.peerDependencies),
__PKG_OPTIONAL_DEPENDENCIES: JSON.stringify(pkg.optionalDependencies),
// Define global values
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
},
build: {
@@ -113,18 +110,19 @@ export default defineConfig((config) => {
resolve: {
alias: {
buffer: 'vite-plugin-node-polyfills/polyfills/buffer',
crypto: 'crypto-browserify',
stream: 'stream-browserify',
},
},
plugins: [
nodePolyfills({
include: ['buffer', 'process', 'util', 'stream'],
include: ['buffer', 'process', 'util', 'stream', 'crypto'],
globals: {
Buffer: true,
process: true,
global: true,
},
protocolImports: true,
// Exclude Node.js modules that shouldn't be polyfilled in Cloudflare
exclude: ['child_process', 'fs', 'path'],
}),
{
@@ -136,6 +134,8 @@ export default defineConfig((config) => {
map: null,
};
}
return null;
},
},
config.mode !== 'test' && remixCloudflareDevProxy(),