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 1
1
{
2
- "type" : " commonjs " ,
2
+ "type" : " module " ,
3
3
"private" : true ,
4
4
"dependencies" : {
5
5
"@fastly/js-compute" : " ^3.33.2" ,
15
15
},
16
16
"scripts" : {
17
17
"prebuild" : " webpack" ,
18
- "build" : " js-compute-runtime bin/index.js bin/main.wasm" ,
18
+ "build" : " js-compute-runtime bin/index.cjs bin/main.wasm" ,
19
19
"start" : " fastly compute serve" ,
20
20
"deploy" : " fastly compute publish"
21
+ },
22
+ "engines" : {
23
+ "node" : " >= 20.11"
21
24
}
22
25
}
Original file line number Diff line number Diff line change 5
5
import { includeBytes } from "fastly:experimental" ;
6
6
import * as jws from "jws" ;
7
7
8
- import fetchConfig from "./config" ;
8
+ import fetchConfig from "./config.js " ;
9
9
10
- import { getQueueCookie , setQueueCookie } from "./cookies" ;
10
+ import { getQueueCookie , setQueueCookie } from "./cookies.js " ;
11
11
12
12
import {
13
13
getStore ,
@@ -16,11 +16,11 @@ import {
16
16
incrementQueueCursor ,
17
17
incrementQueueLength ,
18
18
incrementAutoPeriod ,
19
- } from "./store" ;
19
+ } from "./store.js " ;
20
20
21
- import log from "./logging" ;
21
+ import log from "./logging.js " ;
22
22
23
- import processView from "./views" ;
23
+ import processView from "./views.js " ;
24
24
25
25
const textDecoder = new TextDecoder ( ) ;
26
26
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" ;
3
3
4
- module . exports = {
4
+ export default {
5
5
entry : "./src/index.js" ,
6
6
optimization : {
7
7
minimize : true ,
8
8
} ,
9
9
target : "webworker" ,
10
10
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
+ } ,
14
17
} ,
15
18
module : {
16
19
// Loaders go here.
@@ -27,11 +30,8 @@ module.exports = {
27
30
} ) ,
28
31
] ,
29
32
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 : .* $ / ,
36
36
] ,
37
37
} ;
You can’t perform that action at this time.
0 commit comments