Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #3863
Closed
Open
Issue created Jan 18, 2018 by Administrator@rootContributor

Babel 7 + babel-preset-react-app@next but with TypeScript

Created by: oieduardorabelo

Hello there 👋 ,

I'm trying to unify my building, currently TypeScript & Babel, under Babel 7,

I'm using babel-preset-react-app@next, to keep everything nice and updated, but, when I try to mix with @babel/preset-typescript, I've the following error:

Module build failed: Error: Cannot combine flow and typescript plugins.
screen shot 2018-01-19 at 12 44 13 pm

Seems it's because we've the @babel/preset-flow built in in babel-preset-react-app,

My questions is:

  • Could babel-preset-react-app make a opt-in/out for @babel/preset-flow?

How to reproduce

Keep in mind, below, there's no tsconfig.json yet, because the project doesn't even compile with both presets describe above

  • package.json file:
  "dependencies": {
    "@babel/core": "^7.0.0-beta.38",
    "@babel/preset-typescript": "^7.0.0-beta.38",
    "babel-loader": "8.0.0-beta.0",
    "babel-preset-react-app": "next",
    "babel-runtime": "^6.23.0",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "webpack": "^3.10.0"
  }
  • .babelrc
{
  "presets": ["react-app", "@babel/typescript"]
}
  • webpack.config.js
const path = require("path");

module.exports = {
  entry: "./main.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "dist")
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules)/,
        use: {
          loader: "babel-loader"
        }
      }
    ]
  }
};
  • main.js
import React from "react";
import ReactDOMServer from "react-dom/server";

const App = () => <h1>Hello Wolrd!</h1>;

console.log(ReactDOMServer.renderToString(<App />));
Assignee
Assign to
Time tracking