#can't generate import map

19 messages · Page 1 of 1 (latest)

ashen crest
#

I want to generate new importmap, but there is an error says there is no importmap. This is very strange

➜  ✗ pnpm generate:importmap

> payload@1.0.0 generate:importmap /Volumes/source_code/project
> cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap

Generating import map
node:internal/fs/promises:638
  return new FileHandle(await PromisePrototypeThen(
                        ^

Error: ENOENT: no such file or directory, open '/Volumes/source_code/personal/project/src/app/(payload)/admin/importMap.js'

    at async open (node:internal/fs/promises:638:25)
    at async Object.readFile (node:internal/fs/promises:1242:14)
    at async writeImportMap (/Volumes/source_code/personal/node_modules/.pnpm/payload@3.39.1_graphql@16.11.0_typescript@5.7.3/node_modules/payload/src/bin/generateImportMap/index.ts:150:30)
    at async generateImportMap (/Volumes/source_code/personal/node_modules/.pnpm/payload@3.39.1_graphql@16.11.0_typescript@5.7.3/node_modules/payload/src/bin/generateImportMap/index.ts:109:3)
    at async start (file:///Volumes/source_code/personal
/node_modules/.pnpm/payload@3.39.1_graphql@16.11.0_typescript@5.7.3/node_modules/payload/bin.js:30:7) {
ashen crest
#

So to resolve that problem I just created an empty file importMap.js and that's work. Anyway it looks like a bug

tidal hamlet
#

definately not a bug, more like you didn't point the cross env to the right location

#

as that import map is part of payload that gets generated, so by creating an empty import map your no longer using payload's imports.

ashen crest
#

As I said, I generated absolutely empty file and then I was able to generate importmaps

ashen crest
tidal hamlet
#

that's a scam mate

#

doesn't respond to it

#

ah i see, you somehow managed to delete thet importmap.js from the (payload)/admin

ashen crest
#

Sure thing, cuz I do not need generated js code in my repo, especially when I can generate it at anytime

tidal hamlet
#

that file is actually required for payload

#

so i don't know why you'd delete it from the payload folder

ashen crest
#

Because it is generated js code. You don’t store prisma generated js code at your repo because it doesn’t make sense. You have to save only what is really needed

tidal hamlet
#

but its not for that purpose you need that file dude, that's not for prisma

ashen crest
#

I gave it to you as an example. Any generated code that can be regenerated at anytime shouldn’t be stored at the repository. But that’s fine, let’s end that conversation

tidal hamlet
ripe marsh
#

Just to hop on this conversation, the importmap doesn't need to be generated. It's just the utility that helps you create the file. If there wasn't the generate: utility, you would have to write that file yourself. Same as with generate:types.

thorny shale