Build issues deploying React 16 (not using Next.js) to XDN

Using XDN 2.9.0 and React 16, the application runs using xdn run locally but when deploying to the XDN we get the following error:

2020-09-10T14:41:25Z - internal error - Error while invoking lambda "f8c0631c34f66a51196247a584f94f69f44f45be35f273d96940e9723b54c052": SyntaxError: Cannot use import statement outside a module
2020-09-10T14:41:25Z - internal error - Runtime.UserCodeSyntaxError: SyntaxError: Cannot use import statement outside a module
    at _loadUserApp (/var/runtime/UserFunction.js:98:13)
    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)
    at Object.<anonymous> (/var/runtime/index.js:43:30)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._...
2020-09-10T14:41:25Z - error - DeployBuild job failed

This is in our xdn.config.js:

module.exports = {
  backends: {
    origin: {
      domainOrIp: process.env.ORIGIN_DOMAIN_OR_IP || '',
      hostHeader: process.env.ORIGIN_HOST_HEADER || '',
  server: {
    path: 'src/server.js'

The resolution was that the server.js was not compiled. The path forward is to use webpack to compile the app into a single js file, and then point the xdn.config.js server object at that compiled file. You will then need to enable the includeNodeModules option described here After that the deploy should work fine.