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
  • Merge requests
  • !3484

Allow Babel experimental plugins using package.json create-react-app.…

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/haraldrudell/master into master Nov 22, 2017
  • Overview 6
  • Commits 2
  • Pipelines 0
  • Changes 1

Created by: haraldrudell

fix for #3481 (closed)

test by adding Babel Function bind transform:

  • run create-react-app
  • npm i --save-dev babel-plugin-transform-function-bind
  • add to package.json:
  "create-react-app": {
    "babel": {
      "plugins": [
        "transform-function-bind"
      ]
    }
  },
  • modify src/App.js to use the experimental bind operator:
class App extends Component {
  constructor(o) {
    super(o)

    const thisf = ::this.f // this.f.bind(this) in ancient ECMAScript 2017
    const actualThis = thisf() // if bind no work: undefined

    const isCorrect = this.isCorrect = this === actualThis
    console.log(`this correct: ${isCorrect}`)
  }

  f() {
    return this
  }

  render() {
    return (
      <div className="App">bind operator working: {String(this.isCorrect)}

verify that npm t and npm start still works…

Awesome!

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/haraldrudell/master