You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Better tip for jhipster/generator-jhipster#10184 issue describing full solution in order to use Babel to make IE11 correctly working with JHipster generated applications.
**Tip submitted by [@wmarques](https://github.com/wmarques)**
11
+
**Tip submitted by [@wmarques](https://github.com/wmarques)** & [@anthony-o](https://github.com/anthony-o)
12
12
13
13
JHipster supports only evergreen browsers.
14
14
However you can still easily support some older browsers like Internet Explorer.
@@ -19,3 +19,63 @@ In order to do that you have to:
19
19
2. Then you have two options:
20
20
1. Add the correct polyfills from 'core-js', if you don't know which one you should use, check the Angular CLI project and their polyfills.
21
21
2. Or use babel + [Babel preset-env](https://babeljs.io/docs/en/babel-preset-env#usebuiltins) to automatically import the correct core-js polyfills based on a browserslist file.
22
+
23
+
## Full tip using Babel
24
+
25
+
First, add those `package.json` dependencies: `@babel/core`, `@babel/preset-env` and `babel-loader`. Example with `yarn`:
(tested with the following versions for a working IE11 version on a JHipster v6.3.1 generated application:
30
+
```json
31
+
"@babel/core": "7.6.4",
32
+
"@babel/preset-env": "7.6.3",
33
+
"babel-loader": "8.0.6",
34
+
```
35
+
)
36
+
37
+
Now add the following lines at the top of `src/main/webapp/app/polyfills.ts`:
38
+
```ts
39
+
import'core-js/stable';
40
+
import'regenerator-runtime/runtime';
41
+
```
42
+
43
+
In `webpack/webpack.common.js`, after
44
+
```js
45
+
{
46
+
test:/manifest.webapp$/,
47
+
loader:'file-loader',
48
+
options: {
49
+
name:'manifest.webapp'
50
+
}
51
+
},
52
+
```
53
+
add the following lines:
54
+
```js
55
+
{
56
+
test:/\.js/,
57
+
use: {
58
+
loader:'babel-loader',
59
+
options: {
60
+
"presets": [
61
+
[
62
+
"@babel/preset-env",
63
+
{
64
+
"targets": {
65
+
"firefox":"60",
66
+
"ie":"11"
67
+
},
68
+
"useBuiltIns":"entry",
69
+
"corejs":3
70
+
}
71
+
]
72
+
]
73
+
}
74
+
},
75
+
exclude:/@babel(?:\/|\\{1,2})runtime|core-js/,
76
+
},
77
+
```
78
+
79
+
And finally, change `target` to `es5` in `tsconfig.json` & `tsconfig-aot.json`.
80
+
81
+
See this [GitHub issue](https://github.com/jhipster/generator-jhipster/issues/10184#issuecomment-541650501) & [this SO answer](https://stackoverflow.com/a/58377002/535203) for more details.
0 commit comments