File tree Expand file tree Collapse file tree 5 files changed +19
-2
lines changed Expand file tree Collapse file tree 5 files changed +19
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " wrangler " : patch
3
+ ---
4
+
5
+ Add support for ` --node-compat ` when running ` wrangler pages publish ` . Support for CI will be coming in the future.
Original file line number Diff line number Diff line change @@ -352,6 +352,7 @@ describe("pages", () => {
352
352
--commit-dirty Whether or not the workspace should be considered dirty for this deployment [boolean]
353
353
--skip-caching Skip asset caching which speeds up builds [boolean]
354
354
--no-bundle Whether to run bundling on \`_worker.js\` before deploying [boolean] [default: true]
355
+ --node-compat Enable node.js compatibility [boolean] [default: false]
355
356
356
357
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose"
357
358
` ) ;
Original file line number Diff line number Diff line change @@ -79,7 +79,6 @@ export function Options(yargs: Argv) {
79
79
describe : "Enable node.js compatibility" ,
80
80
default : false ,
81
81
type : "boolean" ,
82
- hidden : true ,
83
82
} ,
84
83
bindings : {
85
84
type : "string" ,
Original file line number Diff line number Diff line change @@ -143,7 +143,6 @@ export function Options(yargs: Argv) {
143
143
describe : "Enable node.js compatibility" ,
144
144
default : false ,
145
145
type : "boolean" ,
146
- hidden : true ,
147
146
} ,
148
147
"experimental-local" : {
149
148
describe : "Run on my machine using the Cloudflare Workers runtime" ,
Original file line number Diff line number Diff line change @@ -78,6 +78,11 @@ export function Options(yargs: Argv) {
78
78
type : "string" ,
79
79
hidden : true ,
80
80
} ,
81
+ "node-compat" : {
82
+ describe : "Enable node.js compatibility" ,
83
+ default : false ,
84
+ type : "boolean" ,
85
+ } ,
81
86
} )
82
87
. epilogue ( pagesBetaWarning ) ;
83
88
}
@@ -93,6 +98,7 @@ export const Handler = async ({
93
98
bundle,
94
99
noBundle,
95
100
config : wranglerConfig ,
101
+ nodeCompat,
96
102
} : PublishArgs ) => {
97
103
if ( wranglerConfig ) {
98
104
throw new FatalError ( "Pages does not support wrangler.toml" , 1 ) ;
@@ -300,6 +306,12 @@ export const Handler = async ({
300
306
let filepathRoutingConfig : string | undefined ;
301
307
302
308
if ( ! _workerJS && existsSync ( functionsDirectory ) ) {
309
+ if ( nodeCompat ) {
310
+ console . warn (
311
+ "Enabling node.js compatibility mode for builtins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details."
312
+ ) ;
313
+ }
314
+
303
315
const outfile = join ( tmpdir ( ) , `./functionsWorker-${ Math . random ( ) } .js` ) ;
304
316
const outputConfigPath = join (
305
317
tmpdir ( ) ,
@@ -319,6 +331,7 @@ export const Handler = async ({
319
331
project . deployment_configs [ isProduction ? "production" : "preview" ]
320
332
. d1_databases ?? { }
321
333
) ,
334
+ nodeCompat,
322
335
} ) ;
323
336
324
337
builtFunctions = readFileSync ( outfile , "utf-8" ) ;
You can’t perform that action at this time.
0 commit comments