Skip to content

Commit

Permalink
Merge pull request #125 from CMSgov/staging
Browse files Browse the repository at this point in the history
Docs: Fix IE 11 in production builds
  • Loading branch information
sawyerh authored Aug 18, 2017
2 parents 8535603 + b115def commit 57dd83c
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/public/scripts/example.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions docs/public/scripts/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"through2": "^2.0.3",
"tota11y": "^0.1.6",
"vinyl-source-stream": "^1.1.0",
"webpack": "^3.5.3",
"webpack": "^3.5.5",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.18.2",
"yargs": "^8.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/scripts/components/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Nav = props => {
<VerticalNav
className='c-nav__list'
items={expandSelectedItems(props.items, props.selectedId)}
selectedId={props.selectedId}
selectedId={props.selectedId ? props.selectedId : undefined}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import React from 'react';
import reactElementToJSXString from 'react-element-to-jsx-string';
require('prismjs/components/prism-jsx');

// Add polyfills to fix react-element-to-jsx-string IE compatibility
// github.com/algolia/react-element-to-jsx-string/issues/147
require('core-js/fn/array/includes');
require('core-js/fn/array/fill');
require('core-js/fn/function/name');
require('core-js/fn/object/get-own-property-symbols');
require('core-js/fn/string/includes');

class ReactComponentExample extends React.PureComponent {
highlightedMarkup() {
const markup = reactElementToJSXString(this.props.renderComponent(), {
Expand Down
10 changes: 10 additions & 0 deletions packages/docs/src/scripts/helpers/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Add polyfills to fix react-element-to-jsx-string IE compatibility. These
// are included in a separate file because they need ran before any other
// code in the bundle to avoid causing issues with React in production mode.
// - github.com/algolia/react-element-to-jsx-string/issues/147
// - github.com/facebook/react/issues/8379#issuecomment-264867090
require('core-js/fn/array/includes');
require('core-js/fn/array/fill');
require('core-js/fn/function/name');
require('core-js/fn/object/get-own-property-symbols');
require('core-js/fn/string/includes');
5 changes: 4 additions & 1 deletion packages/docs/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function createConfig(rootPath = '', hotReload = true) {
let config = {
context: __dirname,
entry: {
index: ['./src/scripts/index.jsx'],
index: [
'./src/scripts/helpers/polyfills.js',
'./src/scripts/index.jsx'
],
example: ['./src/scripts/example.js']
},
output: {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8795,9 +8795,9 @@ webpack-sources@^1.0.1:
source-list-map "^2.0.0"
source-map "~0.5.3"

webpack@^3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.5.3.tgz#e68653963bda146e212832c04a4d8041d2b4b8c8"
webpack@^3.5.5:
version "3.5.5"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.5.5.tgz#3226f09fc8b3e435ff781e7af34f82b68b26996c"
dependencies:
acorn "^5.0.0"
acorn-dynamic-import "^2.0.0"
Expand Down

0 comments on commit 57dd83c

Please sign in to comment.