Skip to content

Commit

Permalink
Fixed error: 'Uncaught TypeError: Cannot read property 'process' of u…
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardsmoses committed Jun 13, 2021
1 parent 3cdaed3 commit 1a0c8cb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import './style.css';

const api = import.meta.env.VITE_API_KEY;
import { Client } from "@notionhq/client"
const apiKey = import.meta.env.VITE_API_KEY;
const databaseId = import.meta.env.VITE_DATABASE_ID;


const getResources = () => {
const notion = new Client({auth: apiKey});
return [{
title: "Sample Resource added with Notion API",
url: "https://google.com",
}]
}

const app = document.querySelector<HTMLDivElement>('#app')!
console.log(api);
console.log(getResources());

app.innerHTML = `
<h1>Hello Vite!</h1>
Expand Down
7 changes: 7 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'

export default defineConfig({
define: {
'process.env': process.env
}
})

1 comment on commit 1a0c8cb

@Chzmo
Copy link

@Chzmo Chzmo commented on 1a0c8cb Dec 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried changing the config file and using import.meta.env didn't work

Please sign in to comment.