Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Express app, multiple issues #42

Open
brianjenkins94 opened this issue Jun 12, 2023 · 1 comment
Open

Express app, multiple issues #42

brianjenkins94 opened this issue Jun 12, 2023 · 1 comment

Comments

@brianjenkins94
Copy link

brianjenkins94 commented Jun 12, 2023

Hi, I'm running into multiple issues with Nodebox trying to run a fairly standard Express app.

Here's my sandbox: https://codesandbox.io/p/sandbox/nodebox-issue-vty6zs

Here are my issues:

// 1.
// These appear to break the Nodebox:
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// 2.
// Despite setting this header, the browser console shows the error:
// > Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec.
response.setHeader("Content-Type", "text/javascript");

// 3.
// response.sendFile() would not work.
//response.sendFile(path.join(__dirname, "public", "js", "main.js"));
// I had to do this as a workaround:
response.send(await fs.readFile("public/js/main.js"));

I think 2 may be related to #39

@brianjenkins94
Copy link
Author

Here's the same sandbox with express removed:

https://codesandbox.io/p/sandbox/nodebox-issue-without-express-676zyk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant