File tree Expand file tree Collapse file tree 3 files changed +22
-19
lines changed Expand file tree Collapse file tree 3 files changed +22
-19
lines changed Original file line number Diff line number Diff line change 11{
2- "type" : " commonjs " ,
2+ "type" : " module " ,
33 "private" : true ,
44 "dependencies" : {
55 "@fastly/js-compute" : " ^3.33.2" ,
1515 },
1616 "scripts" : {
1717 "prebuild" : " webpack" ,
18- "build" : " js-compute-runtime bin/index.js bin/main.wasm" ,
18+ "build" : " js-compute-runtime bin/index.cjs bin/main.wasm" ,
1919 "start" : " fastly compute serve" ,
2020 "deploy" : " fastly compute publish"
21+ },
22+ "engines" : {
23+ "node" : " >= 20.11"
2124 }
2225}
Original file line number Diff line number Diff line change 55import { includeBytes } from "fastly:experimental" ;
66import * as jws from "jws" ;
77
8- import fetchConfig from "./config" ;
8+ import fetchConfig from "./config.js " ;
99
10- import { getQueueCookie , setQueueCookie } from "./cookies" ;
10+ import { getQueueCookie , setQueueCookie } from "./cookies.js " ;
1111
1212import {
1313 getStore ,
@@ -16,11 +16,11 @@ import {
1616 incrementQueueCursor ,
1717 incrementQueueLength ,
1818 incrementAutoPeriod ,
19- } from "./store" ;
19+ } from "./store.js " ;
2020
21- import log from "./logging" ;
21+ import log from "./logging.js " ;
2222
23- import processView from "./views" ;
23+ import processView from "./views.js " ;
2424
2525const textDecoder = new TextDecoder ( ) ;
2626
Original file line number Diff line number Diff line change 1- const path = require ( "path" ) ;
2- const NodePolyfillPlugin = require ( "node-polyfill-webpack-plugin" ) ;
1+ import path from "path" ;
2+ import NodePolyfillPlugin from "node-polyfill-webpack-plugin" ;
33
4- module . exports = {
4+ export default {
55 entry : "./src/index.js" ,
66 optimization : {
77 minimize : true ,
88 } ,
99 target : "webworker" ,
1010 output : {
11- filename : "index.js" ,
12- path : path . resolve ( __dirname , "bin" ) ,
13- libraryTarget : "this" ,
11+ filename : 'index.cjs' ,
12+ path : path . resolve ( import . meta. dirname , "bin" ) ,
13+ chunkFormat : 'commonjs' ,
14+ library : {
15+ type : 'commonjs' ,
16+ } ,
1417 } ,
1518 module : {
1619 // Loaders go here.
@@ -27,11 +30,8 @@ module.exports = {
2730 } ) ,
2831 ] ,
2932 externals : [
30- ( { request, } , callback ) => {
31- if ( / ^ f a s t l y : .* $ / . test ( request ) ) {
32- return callback ( null , 'commonjs ' + request ) ;
33- }
34- callback ( ) ;
35- }
33+ // Allow webpack to handle 'fastly:*' namespaced module imports by treating
34+ // them as modules rather than trying to process them as URLs
35+ / ^ f a s t l y : .* $ / ,
3636 ] ,
3737} ;
You can’t perform that action at this time.
0 commit comments