Skip to content

Cannot use import statement outside a module #2

Answered by sergiodxa
danreeves asked this question in Q&A
Discussion options

You must be logged in to vote

The way I recommend you to use it by setting the server option in the remix.config file, this way Remix will take care of bundling the server file (which can also be written in TS) and then you will do node build/index.js to run it.

If you do this, you will have to also change:

-import * as build from "./build/index.mjs"
+import * as build from "@remix-run/dev/server-build";

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by danreeves
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1 on July 23, 2023 06:55.