#Build errors trying to use the express template with serverModuleFormat: "cjs"

1 messages · Page 1 of 1 (latest)

pulsar mantle
#

I keep getting errors from the server.js file at build becuase it it trying to load ESM modules. I have changed my serverModuleFormat to "cjs". What are the other changes required to used the express template with cjs?

fallow pond
#
  • package.json: delete "type": "module"
  • remix.config: add serverModuleFormat: "cjs"
  • remix.config: change export default to module.export =

You may also need to make that last change to your other config files.

pulsar mantle
#

I did all that but Im still getting errors based on the imports in the server.js file