Apparent error in Netlify code generator

When I issue the ‘netlify serve’ command, a routine (remix-server.mjs) is generated that contains the following statements

import { default as default2 } from "....\buildserverserver.js";

// The import statement above was copied from below and this 
// comment was added to explain what I did 

import {createRequire as ___nfyCreateRequire} from "module";
import {fileURLToPath as ___nfyFileURLToPath} from "url";
import {dirname as ___nfyPathDirname} from "path";
let __filename=___nfyFileURLToPath(import.meta.url);
let      __dirname=___nfyPathDirname(___nfyFileURLToPath(import.meta.url));
let require=___nfyCreateRequire(import.meta.url);

// .netlify/functions-internal/remix-server.mjs
import { default as default2 } from "....\buildserverserver.js";
var config = {
  name: "Remix server handler",
  generator: "@netlify/remix-adapter@2.3.0",
  path: "/*",
  preferStatic: true
export {
  default2 as default

That’s wrong. The imported build server server (really all one word with no spaces) JavaScript file does not exist. The code generator is making some type of mistake.

Has anyone seen this error? How should I fix it in local/remote mode? The remix-server file is in .netlify/functions serve/.unzipped/remix-server/remix-server.mjs.

I’m not sure what you’re asking about. Netlify doesn’t have any code generator. If you’re talking about Netlify CLI, that’s just running your own code which Remix bundled to be deployed to Netlify.

Hi, Thank you for the update. I found the ‘bad’ file in a subdirectory of .netlify. It is created each time I run the ‘netlify serve’ command. What actually triggers the creation of the ‘bad’ file is a ‘remix vite:build’ command. I really don’t know who creates the ‘bad’ file. Is it Netlify? Some other component? I have no idea.

Hi, I have some more information that may help. I have found that the comment ‘netlify dev’ works and ‘netlify serve’ fails. I don’t know why. I have also found that ‘netlify deploy --build’ fails. What I mean by ‘fail’ is that these command generate ‘bad’ code (the failing import statement).

Please share a reproduction git repo so we can check.

How do I post a git repo? Zip it up and send it to you? How and where? Note that ‘netlify dev’ works after I use the Netlify Remix templae (and follow the instructions) and ‘netlify serve’ fails. I don’t know why.

A Zip of the .git directory has not been uploaded. I verified that ‘netlify dev’ works and that ‘netlify serve’ fails. I got an error message when I tried to upload the zip file (“new users can not upload files”).

I created a github repository with the code. The URL is GitHub - pschaeffer/my-remix-app. You might be able to get the git repo from this source.

Hi apologies for missing this? Are you still in need of assistance?