garycourt / uri-js

An RFC 3986 compliant, scheme extendable URI parsing/validating/normalizing/resolving library for JavaScript
Other
305 stars 69 forks source link

Unexpected token during webpack compile after update to 4 #30

Closed NikkiTheBugSlayer closed 6 years ago

NikkiTheBugSlayer commented 6 years ago

After updating to 4 I am getting the following error when I try to compile using webpack 3.11

Unexpected token: name (e) [./node_modules/fni-base/node_modules/uri-js/dist/esnext/uri.js:42,0]

garycourt commented 6 years ago

Does your compiler/minifier support ES6+?

NikkiTheBugSlayer commented 6 years ago

I know it does es6. I am not sure about es6+. How would I find that out?

garycourt commented 6 years ago

No idea, but I'm assuming the issue is related to what was brought up in #28 . Essentially, Webpack is using the module property in package.json when it doesn't support ES6+. I've been meaning to get around to creating a "ES5+Modules" dist for this scenario, but haven't had time to get around to it.

In the mean time, you can work around this by ensuring your compiler (usually Babel) and minifier handle ES6+ features

NikkiTheBugSlayer commented 6 years ago

We are using Babel. We have these presets. 'babel-preset-react', 'stage-0', 'es2015', ['babel-preset-env', { modules: false, targets: { ie9: true, }, uglify: true, }], ] }, }]

Is there another one we should be using?

garycourt commented 6 years ago

Sorry, questions like that are outside the scope of URI.js. I can't help you with that.

garycourt commented 6 years ago

The latest version of URI.js (uri-js@^4.2.2) should fix this issue.