2

I have problem with import .ts files in static.config.js file in my project with React Static I got this error

Unexpected token { import sth from sth }

When i change my static.config.js to static.config.ts i got error

=> File changed: /artifacts/react-static-browser-plugins.js
=> Updating build...
Failed to build! Fix any errors and try again!
multi /MY_PROJECT/node_modules/react-dev-utils/webpackHotDevClient.js (webpack)/hot/only-dev-server.js ../lib/bootstrapPlugins.js ../lib/bootstrapTemplates.js /MY_PROJECT/src/index.js
Module not found: Can't resolve '/MY_PROJECT/src/index.js' in '/MY_PROJECT/node_modules/react-static/node_modules'

My tsconfig.json

   "target": "esnext",
   "module": "esnext",
   "jsx": "preserve",
   "allowJs": true,
   "moduleResolution": "node",
   "allowSyntheticDefaultImports": true,
   "noImplicitAny": true,
   "noUnusedLocals": true,
   "noUnusedParameters": true,
   "removeComments": false,
   "preserveConstEnums": true,
   "sourceMap": true,
   "skipLibCheck": true,
   "baseUrl": "./src",
   "resolveJsonModule" : true,
   "lib": ["dom", "es2015", "es2016"]
}

What to do to be able to import .ts files in static.config.js or what to do to static.config.ts would work?

Hubert Kuzdak
  • 23
  • 1
  • 5

0 Answers0