Skip to content

Commit

Permalink
make json import work in node and wrangler
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis committed Jan 2, 2025
1 parent a03c164 commit 1c08be4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/checkout/database/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* @type {Database}
*/
import data from "./database.json" with { type: "json" };
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const data = require("./database.json");

export default data;
5 changes: 4 additions & 1 deletion src/decide/database/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* @type {Database}
*/
import data from "./database.json" with { type: "json" };
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const data = require("./database.json");

export default data;
5 changes: 4 additions & 1 deletion src/explore/database/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* @type {Database}
*/
import data from "./database.json" with { type: "json" };
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const data = require("./database.json");

export default data;
3 changes: 2 additions & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name = "tractor-store-blueprint"
main = "src/server.cloudflare.js"
compatibility_date = "2024-03-12"
compatibility_date = "2024-09-23"
compatibility_flags = [ "nodejs_compat" ]

[site]
bucket = "./public"

0 comments on commit 1c08be4

Please sign in to comment.