react-boilerplate / react-boilerplate-typescript

⚠️ MOVED TO react-boilerplate/react-boilerplate-cra-template

Home Page:https://github.com/react-boilerplate/react-boilerplate-cra-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Babel Error: Unexpected Token

ashishkumar-compro opened this issue · comments

Description

I am trying to use draft-js-inline-toolbar-plugin inside react-boilerplate-typescript and I am getting the following error:

image

I have tried to use the same library in react-boilerplate, and it's working fine.

Steps to reproduce

Steps to reproduce the behavior:

Clone the following repo:

https://github.com/ashishkumar-compro/draft-js-inline-toolbar-plugin-react-boilerplate-typescript.git

Run the following commands:

  1. npm install
  2. npm start

Expected behavior
The Babel error should not come.

Versions

  • React-Boilerplate: 4.1
  • Node/NPM: 10.16.3 / 6.9.0
  • Browser: Chrome Version 77.0.3865.90

Can you delete these lines in babel.config.js file. I think unused babel typescript plugin is ruining something. It works with me. Can you verify that it works for you too ?

https://github.com/Can-Sahin/react-boilerplate-typescript/blob/05cb407d70d283889f525f2b1cf96c6603f66094/babel.config.js#L16-L21

Hi,

Thanks! It is working now, Also I tried to enable the isTSX option in @babel/plugin-transform-typescript and its working then also.

[
'@babel/plugin-transform-typescript',
{
isTSX: true,
allowNamespaces: true,
},
],

Which option do you recommend, completely removing the plugin or enabling the isTSX option?

Well I suggest you delete it. Babel typescript plugin isnt used. ts-loader does that work better in my opinion. So I kept that plugin as optional. Just remove it I'd say

ok thanx! 😄