Comments (5)
You have to use webpack or something like it to adjust the code to the platforms you need to support. There is no one right answer here.
from nes.
@hueniverse we are experiencing the same error after updating from nes 7.0.3 to @hapi/nes 11.2.2 together with updating hapi from 18.1.0 to @hapi/hapi 18.4.0 and inert from 5.1.0 to @hapi/inert 5.2.2.
We have been using webpack before and after the update. Before, everything works in IE11 but after the update, the Arrow functions unfortunately are not transpiled.
Do you have any idea why this could be happening now after the update?
One thing we did was to apply the suggested fix mentioned in #294 (comment) because we ran in that issue. Could it be somehow related to this?
from nes.
I was able to get around this by adding babel-loader
. See below.
Packages installed
"@babel/core": "7.7.2",
"@babel/polyfill": "7.7.0",
"@babel/preset-env": "7.7.1",
"babel-loader": "8.0.6"
babel.config.js
'use strict';
module.exports = function (api) {
api.cache(true);
const presets = [ '@babel/preset-env'];
const plugins = [];
return {
presets,
plugins
};
};
Added this to my webpack.config.js
module: {
rules: [
{
test: /\.js$/,
include: [ path.resolve('./node_modules/@hapi/nes') ],
use: {
loader: 'babel-loader',
options: {
configFile: path.resolve('./babel.config.js')
}
}
}
]
},
from nes.
@iancamp thank you. We have a similar setup, except that we do not use @babel/polyfill
since it is deprecated.
I think I now proceeded some steps by adding @babel/plugin-transform-arrow-functions
and including it as plugin to babel-loader:
use: {
loader: "babel-loader",
options: {
presets: [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3,
"debug": true,
"targets": {
"chrome": "58",
"ie": "11"
}
}
],
["@babel/preset-react"]
],
plugins: [
...
"@babel/plugin-transform-runtime",
"@babel/plugin-transform-arrow-functions"
],
}
}
I am wondering whether adding @babel/plugin-transform-arrow-functions
should be necessary or has any downsides.
At least it seems to somehow be working like this in IE11 again at the first look. I still have to see if it really works since I did quite some changes around this when trying to solve the issue and therefore a lot of stuff is mixed together now.
from nes.
Oh, didn't realize @babel/polyfill
is deprecated. Thanks for the heads up! I don't think it's necessary for the workaround, anyway.
from nes.
Related Issues (20)
- Unknown authentication strategy HOT 4
- Can not used in IE browser? HOT 2
- Action required: Greenkeeper could not be activated 🚨 HOT 1
- Update deps HOT 1
- Get auth result on connect HOT 2
- nes fails to verify credentials with hapi-auth-jwt2 customVerify function HOT 2
- Client is not working in browser. HOT 5
- Error: Connection requires authentication HOT 1
- Only node 12
- Require hapi 19
- Change plugin name to @hapi/nes
- WSS integration HOT 1
- request.info.remoteAddress is always 127.0.0.1 in request handler
- Cannot get pub/sub example to work HOT 7
- Access server.publish from another file HOT 1
- Non standard browser cookie in Nes authentication HOT 1
- Polling option fallback HOT 1
- Socket closing without prompt
- Error is thrown, if client.connect({auth: 'somestring'})
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 nes.