Skip to content

Commit 40f65de

Browse files
Tony Wiesernmetulev
authored andcommitted
Updated React Sample to add web component polyfills
* Attempted to add polyfill to get react-app to work on edge * Reset to previous formatting * Sample now runs in edge * Added polyfills for IE11
1 parent 3e60cf8 commit 40f65de

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

samples/react-app/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"private": true,
55
"dependencies": {
66
"@microsoft/mgt": "0.1.0-preview.8",
7+
"@webcomponents/webcomponentsjs": "2.2.10",
78
"react": "^16.8.5",
9+
"react-app-polyfill": "1.0.1",
810
"react-dom": "^16.8.5",
911
"react-scripts": "^3.0.0"
1012
},

samples/react-app/src/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
import 'react-app-polyfill/ie11';
2+
import 'react-app-polyfill/stable';
3+
// in theory, we should be able to add this to index.html
4+
// <script>
5+
// window.WebComponents = window.WebComponents || {};
6+
// window.WebComponents.root = '../node_modules/@webcomponents/webcomponentsjs/';
7+
// </script>
8+
// and then
9+
// import '../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js';
10+
// but for some reason it doesn't on edge
11+
// because of this, we'll just load the whole bundle.
12+
import '../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js';
113
import React from 'react';
214
import ReactDOM from 'react-dom';
315
import App from './App';

0 commit comments

Comments
 (0)