react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

Unexpected token: name (onClickOutside)

Open tadjohnston opened this issue 9 years ago • 42 comments

Getting an error on webpack production build.

Unexpected token: name (onClickOutside) [./node_modules/react-onclickoutside/index.js:92,0]

It seems to be fixed in react-onclickoutside version 6.1.0 as mentioned here.

https://github.com/Pomax/react-onclickoutside/issues/195

I noticed this has recently been downgraded, but version 0.57.0 won't build for me and others.

tadjohnston avatar Oct 25 '17 15:10 tadjohnston

I released 0.58 which should fix this problem I believe.

martijnrusschen avatar Oct 25 '17 16:10 martijnrusschen

We downgraded from 6.1 to 6.0 to fix this problem.

martijnrusschen avatar Oct 25 '17 16:10 martijnrusschen

Oh wait, sorry my bad. 0.57 should fix the issue based on https://github.com/Hacker0x01/react-datepicker/pull/1083. Can you describe what's not working for you?

martijnrusschen avatar Oct 25 '17 16:10 martijnrusschen

I'm not sure how much details I can give, but what I can tell you is that using 0.54 works fine. When I bump to 0.57 it breaks and this is only happening when running a webpack production build.

Node: 8.1.2 Webpack: 3.8.1

Running webpack in development mode (NODE_ENV=development) seems to run just fine. Here is the full error:

[client] container-b8552c-ad11534beeb7ba0bb4d4.js from UglifyJs
Unexpected token: name (onClickOutside) [./node_modules/react-onclickoutside/index.js:92,0][container-b8552c-ad11534beeb7ba0bb4d4.js:1603,33]

Here is the uglify config:

  new webpack.optimize.UglifyJsPlugin({
    minimize: false,
    sourceMap: true,
    compress: {
      warnings: false,
      pure_getters: true,
      screw_ie8: true,
      comparisons: false,
    },
  }),

tadjohnston avatar Oct 25 '17 16:10 tadjohnston

We have the same problem as tadjohnston. The problem only occurs during the webpack production build.

josegers avatar Oct 26 '17 06:10 josegers

@martijnrusschen Seems to me this is a different problem you've fixed with downgrading react-onclickoutside to 6.0.0.

The problem I, @tadjohnston and @josegers have is that, ./node_modules/react-onclickoutside/index.js in v6.0.0 is not transpiled and has native ES6 class defined. This is sth that has been fixed in react-onclickoutside v.6.1.0, but you're using a lower version.

amarinov avatar Oct 26 '17 09:10 amarinov

I'm experiencing the same issue with the create-react-app stack. It can't build my application, fails with the message:

image

firec0der avatar Oct 26 '17 10:10 firec0der

+1 here. Reverting to 0.54 seems to be fine. (with react 16 and react-onclickoutside 6.6.2)

rory-austin avatar Oct 26 '17 11:10 rory-austin

Reverting to 0.56.0 works for me.

firec0der avatar Oct 26 '17 13:10 firec0der

This is probably fixed by #1091, can anyone pull down master and give it a shot before we cut a release?

rafeememon avatar Oct 28 '17 15:10 rafeememon

@rafeememon : Yes I'm no it!

aniruddhashevle avatar Oct 28 '17 17:10 aniruddhashevle

@rafeememon : I've followed the below process.

cd myproject/node_modules
git clone https://github.com/Hacker0x01/react-datepicker.git
cd ..
npm start // it works fine
npm run build // gives below error

error

 ERROR in formFlowStructure.bundle.js from UglifyJs
Unexpected token: name (onClickOutside) [formFlowStructure.bundle.js:48997,33]

aniruddhashevle avatar Oct 28 '17 19:10 aniruddhashevle

It works fine with react v16, react-datepicker v0.56.

pawarvijay avatar Oct 28 '17 19:10 pawarvijay

I'm pretty out of the loop here but maybe @Andarist knows what might be going on?

rafeememon avatar Oct 28 '17 23:10 rafeememon

@rafeememon it seems that this was fixed by recently merged in https://github.com/Hacker0x01/react-datepicker/pull/1091 , ofc I might be wrong, as I didn't dig into the issue properly, but from what I read here it is highly possible

The only thing left to do is releasing a new version of react-datepicker

Andarist avatar Oct 29 '17 09:10 Andarist

I'm a bit hesitant of releasing a new version, but I'll cut a patch release so we can give people access to the latest version to play with.

martijnrusschen avatar Oct 29 '17 09:10 martijnrusschen

Oh i didn't mean a major new version, just an updated one - patch, minor, whatever :P

Andarist avatar Oct 29 '17 09:10 Andarist

I have same issue while building to production with react16 It is a bummer screenshot 2017-10-29 18 25 42

JustFly1984 avatar Oct 29 '17 10:10 JustFly1984

@aniruddhashevle I'm not sure that's enough to run the new version. You'll also need to pull in the latest version of react-onclickoutside.

rafeememon avatar Oct 29 '17 16:10 rafeememon

I have the same issue while building to production with react 15.6.2

siarheipashkevich avatar Oct 30 '17 14:10 siarheipashkevich