DVLP / signalr-no-jquery

120 stars 77 forks source link

0.1.7 breaks build w/ uglifyjs #17

Closed cwalv closed 4 years ago

cwalv commented 7 years ago

including this in a create-react-app project, with 0.1.6 everything built fine, but with 0.1.7 I get:

$ npm run build

> haas-react-ui@0.1.0 build S:\source\git\tmp
> node scripts/build.js

Creating an optimized production build...
Failed to compile.

static/js/main.8d3da965.js from UglifyJs
SyntaxError: Unexpected token: name (events) [./~/signalr-no-jquery/build/jQueryShim.js:7,0]
zdh8675 commented 7 years ago

I have solved the problem, but my code environment is vue.js

You can look at this link, may be helpful: http://www.ruanyifeng.com/blog/2016/01/babel.html

Alternatively, Babel provides a REPL online compiler that can convert ES6 code to ES5 code online. The converted code can be run directly as an ES5 code into a web page. Open the following link: https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015%2Creact%2Cstage-2&targets=&browsers=&builtIns=false&debug=false&code=

gtwilliams03 commented 7 years ago

It is the "let" statements in the updated jQueryShim.js file. But I don't see a problem with the babel settings. Yet. But I'm getting the same error and I didn't with my fork.

gtwilliams03 commented 7 years ago

Removed signalr-no-jquery. Removed babel-loader and upgraded to babel-loader v7. Reinstalled signalr-no-jquery and it passes with no UglifyJs errors. Not sure if this is the exact sequence because I was trying a bunch of things, but it is working now.

robvree commented 7 years ago

Running into the same issue. I don't use babel-loader.

ERROR in main.5b60de6b565acc47a65a.min.js from UglifyJs Unexpected token: name (events) [C:/Users/rob/Documents/Web/~/source-map-loader!C:/Users/rob/Documents/Web/~/signalr-no-jquery/build/jQueryShim.js:7,0][main.5b60de6b565acc47a65a.min.js:25643,6]

robvree commented 7 years ago

Solved for my TypeScript Webpack build. I installed babel-loader, babel-core and babel-preset-es2015 and then added the following to my production webpack config.

{ test: /.js$/, loader: 'babel-loader', query: { presets: ['es2015'] }, include: resolve(__dirname, "../../../../node_modules/signalr-no-jquery"), }

robvree commented 7 years ago

Actually... It compiles, but it breaks IE11 and Edge. Can you please ship ES5 transpiled versions of the code? Users really should not have to try and transpile code in node_modules.

DVLP commented 7 years ago

Thanks for reporting the problem. Has anyone fixed his version in a fork and can make a pull request?

robvree commented 7 years ago

PR created

robvree commented 7 years ago

Can someone please review my PR

DVLP commented 7 years ago

merged