From 6b01346b9635019b8fb7942b1d64031cce2f782b Mon Sep 17 00:00:00 2001 From: Katsuyuki Omuro Date: Wed, 26 Mar 2025 11:31:18 +0900 Subject: [PATCH 1/3] Consistent package.json --- package.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 5bb78b2..3861c5f 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,11 @@ { - "engines": { - "node": "^18" + "type": "commonjs", + "private": true, + "dependencies": { + "@fastly/js-compute": "^3.33.2" }, "devDependencies": { - "@fastly/cli": "^10.14.0", + "@fastly/cli": "^11.0.0", "buffer": "^6.0.3", "core-js": "^3.33.1", "g": "^2.0.1", @@ -12,12 +14,9 @@ "path-browserify": "^1.0.1", "process": "^0.11.10", "stream-http": "^3.2.0", - "webpack": "^5.89.0", + "webpack": "^5.98.0", "webpack-cli": "^5.1.4" }, - "dependencies": { - "@fastly/js-compute": "^3.0.0" - }, "scripts": { "prebuild": "webpack", "build": "js-compute-runtime bin/index.js bin/main.wasm", From 69f8a43a5f82065c74e6f5298b45236823b7b920 Mon Sep 17 00:00:00 2001 From: Katsuyuki Omuro Date: Wed, 9 Apr 2025 18:03:10 +0900 Subject: [PATCH 2/3] Updates to make more correct --- package.json | 5 ++++- webpack.config.js | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3861c5f..d93f3f2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "type": "commonjs", + "type": "module", "private": true, "dependencies": { "@fastly/js-compute": "^3.33.2" @@ -22,5 +22,8 @@ "build": "js-compute-runtime bin/index.js bin/main.wasm", "start": "fastly compute serve", "deploy": "fastly compute publish" + }, + "engines": { + "node": ">= 20.11" } } diff --git a/webpack.config.js b/webpack.config.js index 76abf4b..054556a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,7 +1,10 @@ -const path = require("path"); -const webpack = require("webpack"); +import { createRequire } from "module"; +import path from "path"; +import webpack from "webpack"; -module.exports = { +const require = createRequire(import.meta.url); + +export default { entry: "./src/index.js", optimization: { minimize: true, @@ -9,7 +12,7 @@ module.exports = { target: "webworker", output: { filename: "index.js", - path: path.resolve(__dirname, "bin"), + path: path.resolve(import.meta.dirname, "bin"), libraryTarget: "this", }, module: { From b5ff963dba56bd9e341bee44e27e70518733449e Mon Sep 17 00:00:00 2001 From: Katsuyuki Omuro Date: Wed, 9 Apr 2025 18:11:23 +0900 Subject: [PATCH 3/3] Update to Node 20.11 (Some syntax used in webpack.config needs this minimum version) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6f7abe..a6c9ddc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: '18' + node-version: '20.11' - name: Setup Fastly CLI uses: fastly/compute-actions/setup@v5 - name: Install Dependencies