Closed andriidiachukTIQ closed 4 years ago
Hi @andriidiachukTIQ ! At the moment, Jexl relies on the programmer using a frontend build tool if they'd like to use it in-browser, and unfortunately there's not much I can contribute if the build tool is producing code that a certain browser can't understand. Do you have any more details on what's failing, specifically? If there's an easy change I can make to Jexl to make it compatible with another build tool, I'd be happy to help.
hi! could u transfer to es 5 before publishing? there is a compitable prodblem with ie 11 or lower versions... similar issue: https://github.com/TomFrost/Jexl/issues/57
thank u~~~
Hi there, I'm running into a similar issue in an Angular8 app when specifically transpiling to ES5 and bundling with Webpack.
Not sure how this is playing out for other folks, but the transpiled ES5 code errors out in Internet Explorer 11 in this vicinity, and I'm thinking that the problem must be related to that arrow function that shouldn't be allowed:
"number"==typeof t&&void 0===n)throw new Error("SubtractPipe: missing required arguments");return o(e).subtract(t,n)},r([i.Pipe({name:"amSubtract"})],e)}()},"01TT":function(e,t){const n=/^-?(?:(?:[0-9]*\.[0-9]+)|[0-9]+)$/,r=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,i=/\\\\/,o=/^\s*$/,a=["'(?:(?:\\\\')|[^'])*'",'"(?:(?:\\\\")|[^"])*"',"\\s+","\\btrue\\b","\\bfalse\\b"],l=["[a-zA-Z_\\$][a-zA-Z0-9_\\$]*","(?:(?:[0-9]*\\.[0-9]+)|[0-9]+)"],s=["binaryOp","unaryOp","openParen","openBracket","question","colon"];e.exports=class{constructor(e){this._grammar=e}getElements(e){const t=this._getSplitRegex();return e.split(t).filter(e=>e)}
I'm not sure how/why it would be resistant or immune to proper transpiling. Anyone have any ideas? I see the reference to https://github.com/TomFrost/Jexl/issues/57 to have a specific ES5 build. Does that seem like it would help, @DearGaz ?
Update to this; it appears that the Angular compiler/transpiler doesn't bother to try to transpile third party ES6 libraries at all, that's the problem.
https://github.com/angular/angular-cli/issues/13806
Looks like the only option would be to provide an ES5 traspiled version of this library (as per the ask in https://github.com/TomFrost/Jexl/issues/57). Would appreciate some help and/or thoughts on this! Thanks.
@MichaelTurbe Bingo! I'm using react and bundling with webpack. i added a property in the webpack config file and solved the problem. it looks like this:
extraBabelIncludes:[ "/node_modules/jexl/lib" /]
@DearGaz, where is your webpack config file? I am using the Angular 9 project.
@MichaelTurbe I also get the same error when compiling my project with Angular 9.
@akshaygolash just look like this:
webpack.config.js
{ ..., extraBabelIncludes:[ "/node_modules/jexl/lib" ], ... }
Once extraBabelIncludes is provided, webpack will compile them to es5 using babel. But i don't know how to solve this problem in angular project. Good luck!
@TomFrost See this stackoverflow question for a typical way to publish IE11-compatible (ES5) code to npm.
The attention this has gotten has me reconsidering -- a prepublish routine may be a good middle ground. Stay tuned.
Closing in favor of #57
Importing jexl in react app "import jexl from 'jexl';" returns error for Explorer 11
"jexl": "^2.1.1", "react": "^16.8.6",