Closed ethangclark closed 2 years ago
this is primarily due to how your app and server are built. at build time, they both are output at ./build
, so trying to import from ./app/foo
won't exist. but if you update that import to import { bar } from './index'
it won't exist there either as it would have been treeshaken out by esbuild due to not being used during that build 😅.
as for "Error: Cannot find module '~/foo'"
you can't use tsconfig path aliases without running it with node --require tsconfig-paths/register
as node by default doesn't understand the alias.
See https://github.com/remix-run/blues-stack/pull/84 (cc @mcansh )
Have you experienced this bug with the latest version of the template?
yes
Steps to Reproduce
npx create-remix --template remix-run/blues-stack
app/foo.ts
in base directory with contentsexport const bar = 'baz'
import { bar } from './foo'
toserver.ts
npm run setup && npm run build && npm run start
Expected Behavior
✅ app ready: http://localhost:3000
Actual Behavior
Error: Cannot find module '~/foo'