Isaac McFadyen | YYZ01
03/15/2022, 2:51 AM.js
files and there's a .ts
equivilant?Isaac McFadyen | YYZ01
03/15/2022, 2:51 AMBytesource
03/15/2022, 2:54 AMxy.ts
as xy.js
should work (because at the time it's imported, xy.ts
has already been transformed to xy.js
)?Isaac McFadyen | YYZ01
03/15/2022, 2:55 AMIsaac McFadyen | YYZ01
03/15/2022, 2:56 AMIsaac McFadyen | YYZ01
03/15/2022, 2:56 AMBytesource
03/15/2022, 2:56 AMBytesource
03/15/2022, 3:21 AM.ts
as .js
still didn't work on the server:
11:10:10.125 ✘ [ERROR] Could not resolve "../credentials.js"
11:10:10.126
11:10:10.126 ../../../buildhome/repo/functions/contact/index.ts:4:22:
11:10:10.126 4 │ import { Creds } from '../credentials.js';
11:10:10.126 ╵ ~~~~~~~~~~~~~~~~~~~
11:10:10.126
11:10:10.128 1 error(s) and 0 warning(s) when compiling Worker.
11:10:10.129 Build failed with 1 error:
11:10:10.129 ../../../buildhome/repo/functions/contact/index.ts:4:22: ERROR: Could not resolve "../credentials.js"
Maybe the working directly on local functions
and on the server is different? But then again, importing .js
files works just fine.
Anyway, this is the file structure of my functions
folder:
functions/
contact/
index.ts
_middleware.ts
credentials.ts
Lastly, this is the line where I import credentials.ts
into `index.ts`:
import { Creds } from '../credentials.js';
JacobParis
03/15/2022, 9:13 AMJacobParis
03/15/2022, 9:14 AM/public/_worker.js
it will be uploaded as the Page functionJacobParis
03/15/2022, 9:14 AMJacobParis
03/15/2022, 9:15 AMn
03/15/2022, 12:31 PMErwin
03/15/2022, 1:09 PMn
03/15/2022, 1:22 PMErwin
03/15/2022, 1:35 PMn
03/15/2022, 1:36 PMErwin
03/15/2022, 1:37 PMErwin
03/15/2022, 1:39 PMn
03/15/2022, 1:40 PMErwin
03/15/2022, 1:41 PMn
03/15/2022, 1:42 PMErwin
03/15/2022, 1:44 PMn
03/15/2022, 1:53 PMn
03/15/2022, 1:54 PMn
03/15/2022, 1:57 PMErwin
03/15/2022, 1:59 PMErwin
03/15/2022, 1:59 PMGreg Brimble | Cloudflare Pages
03/15/2022, 2:33 PMnpx wrangler pages dev
will stream all your `console.log`s to the terminal in local devIsaac McFadyen | YYZ01
03/15/2022, 2:33 PM