New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not work in IE11 #268
Comments
I have the same issue. Following is a minimum example. app.js import $ from 'cash-dom';
$('#cash').on('click', (e) => {
$('#body').toggle()
}); webpack.config.js const path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'app.js'),
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader'
},
],
exclude: /node_modules/
}
]
},
resolve: {
extensions: [
'.js'
]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
} index.html <html>
<head></head>
<body>
<div id="cash" style="width:100%; height: 50%; background: black;"></div>
<div id="body" style="width:100%; height: 50%; background: black;"></div>
<script src="./dist/bundle.js"></script>
</body>
</html> package.json {
"scripts": {
"build": "webpack --mode development"
},
"dependencies": {
"@babel/core": "^7.4.0",
"cash-dom": "^3.1.0"
},
"devDependencies": {
"babel-loader": "^8.0.5",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
}
} npm install && npm run build This may fix by changing pacco plugin settings (enable babel or typescript target to es5 ). |
The esm build is meant to be used in esm-supporting environments. If you want to use it in IE11 I think you'd have to configure webpack to transpile it to ES5 via babel or something. But I'm not hugely familiar with webpack in this regard, am I missing something? Alternatively I think one could instruct webpack to load the |
@fabiospampinato Thanks, It makes sense :) |
I'm closing this then. It will be helpful to other users if you guys shared a webpack configuration that handles the transpilation properly. |
@fabiospampinatoThanks, I understand. I'm grateful for your support. |
Using |
@fabiospampinato I'd like to reopen this. Webpack relies on
The proposed solution (@makotot) suggests changing the Webpack configuration for every package to look at However, adding a
|
@ipavlic Oh cool, do you happen to know where this "web" property is documented? |
@ipavlic Wouldn't this mean though that |
Sorry, it's
|
I think it just works. |
Another alternative is to polyfill in Webpack:
|
Facing the same issue here. @fabiospampinato could you please merge and release #291 ? I can confirm that it's the correct solution for this issue. |
Right now, I have to use |
@limonte I'm quite busy right now, I can't properly test this at the moment. I'd be happy to merge the change if it allows the library to be imported under all the following scenarios:
If somebody could provide me some sample configs/projects that show that these all work, so that I could just try them very quickly, I'll probably be able to merge the change in faster. |
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 #291. Basically the only problem was when importing cash via 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 New release coming soon (I want to take care of a few other issues first). |
Isn't zip too old-school? :) Why not the repo under your username? |
I don't know it's probably garbage, but I didn't want to just delete it. |
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( 1eaddca#diff-33b3d582ba732231f8b49c1ba1fcf7f8R16 ). Is it what should be?Expected behavior
Works well in IE11.
The text was updated successfully, but these errors were encountered: