Is this a bug report?
Yes
Environment
CRA ^2.0.6-next.c662dfb0 with TypeScript support
Steps to Reproduce
npx create-react-app --scripts-version @next myapp
cd myapp
yarn add typescript @types/react @types/react-dom @types/jest
mv src/index.{js,tsx}
- Add
src/setupProxy.js with following content:
const proxy = require('http-proxy-middleware')
module.exports = function(app) {
app.use(proxy('/api', { target: 'http://localhost:5000/' }))
}
yarn run build
Expected Behavior
setupProxy.js should be compiled without any problems.
Actual Behavior
Behold the "Type error: Cannot compile namespaces when the '--isolatedModules' flag is provided. TS1208" error message.
Additionally: if one were to rewrite the setupProxy.js script with proper ES6 exports like this:
const proxy = require('http-proxy-middleware')
export const setupProxy = (app) => {
app.use(proxy('/api', { target: 'http://localhost:5000/' }))
}
yarn run build compiles successfully, while yarn run start claims "unexpected token export".
Is this a bug report?
Yes
Environment
CRA ^2.0.6-next.c662dfb0 with TypeScript support
Steps to Reproduce
npx create-react-app --scripts-version @next myappcd myappyarn add typescript @types/react @types/react-dom @types/jestmv src/index.{js,tsx}src/setupProxy.jswith following content:yarn run buildExpected Behavior
setupProxy.jsshould be compiled without any problems.Actual Behavior
Behold the "Type error: Cannot compile namespaces when the '--isolatedModules' flag is provided. TS1208" error message.
Additionally: if one were to rewrite the
setupProxy.jsscript with proper ES6 exports like this:yarn run buildcompiles successfully, whileyarn run startclaims "unexpected token export".