Comments (14)
Related issue yahoo/react-stickynode#111
from subscribe-ui-event.
Hi, I just updated to 2.0.2 but still caught the error of using const
in IE 10, Chrome < 41 and Safari 9
I believe these 2 files index.es.js
and index.js
should also be transpiled with Babel?
from subscribe-ui-event.
The index.es.js
file should only be used by browsers that support ES6 features. Older browsers should use index.js
. Compiling index.es.js
to ES5 defeats the purpose of the file itself. How is the index.es.js
file being loaded in older browsers? What is your compile step like?
from subscribe-ui-event.
Thanks for response. I created a demo to show it: https://gist.github.com/houkanshan/8b2734c61b4b1ef7055a951a082db020
- In my config for babel-loader,
node_modules & bower_components
is excluded for improving performance according to the doc. - webpack choose to import
index.es.js
bypkg.module
According to the rollup's doc:
pkg.module will point to a module that has ES2015 module syntax but otherwise only syntax features that the target environments support.
and the discussion on webpack, I believe currently the pkg.module
is only for ES2015 module syntax, the rest of the code is still suggested that be precompiled to ES5. As for pure ES6 code, maybe we can use other name like pkg.esnext
in the future according to 2ality's proposal?
from subscribe-ui-event.
webpack use "module"
field by default.
Because, default resolve.mainFields
's value is ['browser', 'module', 'main']
.
(I've used react-stickynode. it break old browser for the above reason)
Currently, I've used a workaround for this issue.
webpack.config.js
:
module.exports = {
// ...cut...
alias: {
'subscribe-ui-event': path.join(__dirname, `node_modules/subscribe-ui-event/index.js`)
)
}
}
from subscribe-ui-event.
@azu , yes, Webpack use "module" field by default because they are following the Rollup's proposal about pkg.module
.
But I had checked node_modules/subscribe-ui-event/index.js
and it's still using the const
keyword. So I'm not sure how this alias fixed that problem.
Anyway, this is my workaround:
{
loader: 'babel-loader',
test: /\.jsx?$/,
exclude: {
test: [
path.resolve(__dirname, '../node_modules'),
path.resolve(__dirname, '../bower_components'),
],
exclude: /subscribe-ui-event/,
},
},
It informs the developers that "subscribe-ui-event
has ES6 code, Babel should handle it".
from subscribe-ui-event.
is this fixed?. It happen on my project too. Can't build the project.
from subscribe-ui-event.
I had to downgrade react-stickynode because of this.
from subscribe-ui-event.
what about adding a browser field with no const
in it?
from subscribe-ui-event.
@houkanshan tried code above, did not change that const was still in the file.
from subscribe-ui-event.
@roderickhsiao can this be closed now? or we still have an issue?
from subscribe-ui-event.
It seems like the build error is gone, now the issue is the const
part for old browser.
I think we could just replace const
from https://github.com/yahoo/subscribe-ui-event/blob/master/index.js
from subscribe-ui-event.
Yes please
from subscribe-ui-event.
@redonkulus could close this :)
from subscribe-ui-event.
Related Issues (8)
- ArgmentedEvent.prototype.update method a little bit verbose. HOT 2
- Use lodash instead of individual lodash packages HOT 2
- The throttledEndEvent doesn't get emitted when using a different target
- broken 1.0.11 release HOT 1
- support passive event HOT 3
- Listen element's scroll not only window's HOT 1
- Change package.json Deprecated licenses tag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subscribe-ui-event.