Skip to content

Commit

Permalink
Merge pull request #6544 from marmelab/simple-example-ie11
Browse files Browse the repository at this point in the history
Ensure simple demo runs on ie11
  • Loading branch information
fzaninotto authored Aug 31, 2021
2 parents d33a4ee + c92489e commit e77755d
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 67 deletions.
65 changes: 38 additions & 27 deletions examples/simple/index-webpack.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Admin</title>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<div id="root"></div>
<!-- This script adds the Roboto font to our project. For more detail go to this site: http://www.google.com/fonts#UsePlace:use/Collection:Roboto:400,300,500 -->
<script>
var WebFontConfig = {
google: { families: ['Roboto:300,400,500,700:latin'] }
};
(function () {
var wf = document.createElement('script');
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
</body>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Admin</title>
<style>
body {
margin: 0;
}
</style>
<script>
const modernBrowser = 'fetch' in window && 'assign' in Object;
if (!modernBrowser) {
const scriptElement = document.createElement('script');
scriptElement.async = false;
scriptElement.src = '/polyfills.bundle.js';
document.head.appendChild(scriptElement);
}
</script>
</head>
<body>
<div id="root"></div>
<!-- This script adds the Roboto font to our project. For more detail go to this site: http://www.google.com/fonts#UsePlace:use/Collection:Roboto:400,300,500 -->
<script>
var WebFontConfig = {
google: { families: ['Roboto:300,400,500,700:latin'] },
};
(function () {
var wf = document.createElement('script');
wf.src =
'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
<script src="/index.bundle.js"></script>
</body>
</html>
69 changes: 35 additions & 34 deletions examples/simple/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
{
"name": "simple",
"version": "3.0.0",
"scripts": {
"dev": "./node_modules/.bin/webpack-dev-server --progress --color --hot --watch --mode development",
"start": "vite",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
"ra-data-fakerest": "^3.9.3",
"ra-i18n-polyglot": "^3.12.4",
"ra-input-rich-text": "^3.12.0",
"ra-language-english": "^3.12.4",
"ra-language-french": "^3.12.4",
"react": "^17.0.0",
"react-admin": "^3.12.4",
"react-dom": "^17.0.0"
},
"devDependencies": {
"@babel/preset-react": "^7.12.10",
"@vitejs/plugin-react-refresh": "^1.3.3",
"ts-loader": "^8.0.14",
"html-loader": "~1.3.0",
"html-webpack-plugin": "~4.3.0",
"ignore-not-found-export-plugin": "^1.0.1",
"style-loader": "~1.2.1",
"typescript": "^4.1.3",
"vite": "^2.2.3",
"webpack": "~4.5.0",
"webpack-cli": "~2.0.13",
"webpack-dev-server": "~3.1.11"
}
"name": "simple",
"version": "3.0.0",
"scripts": {
"dev": "./node_modules/.bin/webpack-dev-server --progress --color --hot --watch --mode development",
"start": "vite",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
"ra-data-fakerest": "^3.9.3",
"ra-i18n-polyglot": "^3.12.4",
"ra-input-rich-text": "^3.12.0",
"ra-language-english": "^3.12.4",
"ra-language-french": "^3.12.4",
"react": "^17.0.0",
"react-admin": "^3.12.4",
"react-dom": "^17.0.0"
},
"devDependencies": {
"@babel/preset-react": "^7.12.10",
"@vitejs/plugin-react-refresh": "^1.3.3",
"ts-loader": "^8.0.14",
"html-loader": "~1.3.0",
"html-webpack-plugin": "~4.3.0",
"ignore-not-found-export-plugin": "^1.0.1",
"react-app-polyfill": "^1.0.4",
"style-loader": "~1.2.1",
"typescript": "^4.1.3",
"vite": "^2.2.3",
"webpack": "~4.5.0",
"webpack-cli": "~2.0.13",
"webpack-dev-server": "~3.1.11"
}
}
3 changes: 3 additions & 0 deletions examples/simple/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import 'proxy-polyfill/proxy.min.js';
6 changes: 2 additions & 4 deletions examples/simple/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
"declaration": true,
"allowJs": false,
"jsx": "react",
"lib": [
"es2017",
"dom"
],
"lib": ["es2017", "dom"],
"target": "es5",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
Expand Down
8 changes: 6 additions & 2 deletions examples/simple/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: './src/index.tsx',
entry: {
polyfills: './src/polyfills.ts',
index: './src/index.tsx',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
filename: '[name].bundle.js',
},
devtool: 'cheap-module-source-map',
resolve: {
Expand Down Expand Up @@ -33,6 +36,7 @@ module.exports = {
plugins: [
new HtmlWebpackPlugin({
template: './index-webpack.html',
inject: false,
}),
],
devServer: {
Expand Down

0 comments on commit e77755d

Please sign in to comment.