lucid
lucid copied to clipboard
This import assertion requires the loader to be "json" instead:
hello i was curious about deno fresh framework and decided i would try to use lucid in this environment. i am still learning so maybe i did something wrong but from i can tell the error is coming from the library itself when trying to load blockfrost.ts
✘ [ERROR] The file "https://deno.land/x/[email protected]/package.json" was loaded with the "js" loader
https://deno.land/x/[email protected]/src/core/core.ts:3:24:
3 │ import packageJson from "../../package.json" assert { type: "json" };
╵ ~~~~~~~~~~~~~~~~~~~~
This import assertion requires the loader to be "json" instead:
https://deno.land/x/[email protected]/src/core/core.ts:3:54:
3 │ import packageJson from "../../package.json" assert { type: "json" };
╵ ~~~~~~~~~~~~
You need to either reconfigure esbuild to ensure that the loader for this file is "json" or you need to remove this import assertion.
here is my component for reference
import {
h,
Component,
} from "https://unpkg.com/preact@latest/dist/preact.module.js";
import { Blockfrost, Lucid } from "https://deno.land/x/[email protected]/mod.ts";
class WalletConnector extends Component {
lucid: any;
async connectWallet() {
this.lucid = await Lucid.new(
new Blockfrost(
"**********************",
"**********************"
),
"Preprod"
);
const api = await window.cardano.nami.enable();
this.lucid.selectWallet(api);
}
render() {
return (
<button onClick={this.connectWallet.bind(this)}>Connect Wallet</button>
);
}
}
export default WalletConnector;