GithubHelp home page GithubHelp logo

Comments (2)

fchevallieratecna avatar fchevallieratecna commented on May 21, 2024 1

Wow that's much more than what I expected. I hope it will help some other people if needed :)

Many thanks to you !!

from remix-v2-server.

xHomu avatar xHomu commented on May 21, 2024

This is because the tsconfig that the template comes with has a noEmit flag. Remix takes care of building everything in remix build -- everything excepts what's happening in your express server file. Adding the middleware to tsconfig won't do anything because of noEmit.

That part is a bit confusing, but this is why there's a seperate script in package.json specifically for server.ts in the build step "build:server": "esbuild --platform=node --format=cjs ./server.ts --outdir=./",

There are a couple ways to fix this:

  1. Keep using esbuild & update the script: build:server": "esbuild --platform=node --format=cjs ./server.ts ./server/middlewares/test.ts --outdir=./",
  2. Don't use esbuild and create a new tsconfig profile for the server.

Option 2 is what we use on mana.wiki as well, since the express server itself is light enough that esbuild performance doesn't make a huge difference https://github.com/manawiki/core/blob/main/package.json#L8

I posted a PR to show how it works: fchevallieratecna/remix-v2-server#1

Note that when deploying, you have to make sure the built files are actually shipped. You may want to change the outDir to somewhere else to simplify the process.

from remix-v2-server.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.