cash: Does not work in IE11
Current behavior
In IE11, cash does not work bacause of Expected identifier error.
This error is caused by remaining class syntax in ./dist/cash.esm.js (I’m using webpack v4 and it imports esm version of cash).
https://github.com/kenwheeler/cash/blob/fbe3dc0966653b67e464f32f5efa3b1f5e3a68c4/dist/cash.esm.js#L16
class syntax seems to be appeared from 3.0.0( https://github.com/kenwheeler/cash/commit/1eaddca7a63332410ba9d3f01d304137baafa97c#diff-33b3d582ba732231f8b49c1ba1fcf7f8R16 ). Is it what should be?
Expected behavior
Works well in IE11.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (14 by maintainers)
I’m closing this then. It will be helpful to other users if you guys shared a webpack configuration that handles the transpilation properly.
I’ve build a thing for checking that cash can be properly imported under the most common environments (attached below, it may come in handy in the future).
This issue has ben fixed by https://github.com/kenwheeler/cash/pull/291. Basically the only problem was when importing cash via
requireand when bundling that with webpack. I’m not quite sure why that was happening to be honest.The bottom line is that importing cash should now work everywhere, and when explicitly importing cash it won’t pollute the global namespace. If you want
$to be globally available just expose it yourself:window.$ = $.New release coming soon (I want to take care of a few other issues first).
cash-dom-import-test.zip
@fabiospampinato I’d like to reopen this. Webpack relies on
package.jsonof various packages to be able to resolve the module. It has a sensible default forwebtarget:browserfollowed bymoduleand finallymain.cashadvertises support for “modern browsers (IE10+)” and itspackage.jsoncontains justmainandmodule.The proposed solution (@makotot) suggests changing the Webpack configuration for every package to look at
mainfield first andmodulefield next, which would work forcash, given the contents of itspackage.jsonfile.However, adding a
browserfield to point todist/cash.jswould work just as well, and would work with no global changes required on Webpack configuration.Using
resolve.mainFieldslikemainfilelds: ["main", "module"]may be the optimal solution for this issue. ref: https://github.com/webpack/webpack/issues/1979@fabiospampinatoThanks, I understand. I’m grateful for your support.