Skip to content

Commit

Permalink
fix typo and update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nihgwu committed Apr 9, 2019
1 parent afd833a commit 6a62d32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
6 changes: 2 additions & 4 deletions docs/docs/browser-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ By default, Gatsby emulates the following config:
If you only support newer browsers, make sure to specify this in your
`package.json`. This will often enable you to ship smaller JavaScript files.

## Note about IE < 11
## Note about IE support

React depends on collection types `Map` and `Set`. While these are not used by Gatsby, Gatsby uses React and you will need to polyfill these if you support older browsers and devices including IE < 11.

Read more about this in [https://reactjs.org/docs/javascript-environment-requirements.html](https://reactjs.org/docs/javascript-environment-requirements.html)
Gatsby will polyfil minimum requirements for IE support according to the `browserslist` config.
16 changes: 8 additions & 8 deletions packages/gatsby/src/utils/__tests__/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ describe(`environment variables`, () => {
})
})

describe(`polyfil for ie support`, () => {
it(`should not add ie polyfil if ie is not supported`, async () => {
describe(`polyfill for ie support`, () => {
it(`should not add ie polyfill if ie is not supported`, async () => {
const config = await getConfig(
{ browserslist: `defaults, not ie >= 9` },
`gatsby-app`,
Expand All @@ -130,41 +130,41 @@ describe(`polyfil for ie support`, () => {
expect(config.entry.app).toEqual([`gatsby-app/.cache/production-app`])
})

it(`should add ie9 polyfil if ie >= 9 is supported`, async () => {
it(`should add ie9 polyfill if ie >= 9 is supported`, async () => {
const config = await getConfig(
{ browserslist: `defaults, ie >= 9` },
`gatsby-app`,
`build-javascript`
)

expect(config.entry.app).toEqual([
`react-app-polyfill/ie9`,
`react-app-polyfilll/ie9`,
`gatsby-app/.cache/production-app`,
])
})

it(`should add ie9 polyfil if ie >= 10 is supported`, async () => {
it(`should add ie9 polyfill if ie >= 10 is supported`, async () => {
const config = await getConfig(
{ browserslist: `defaults, ie >= 10` },
`gatsby-app`,
`build-javascript`
)

expect(config.entry.app).toEqual([
`react-app-polyfill/ie9`,
`react-app-polyfilll/ie9`,
`gatsby-app/.cache/production-app`,
])
})

it(`should add ie11 polyfil if ie >= 11 is supported`, async () => {
it(`should add ie11 polyfill if ie >= 11 is supported`, async () => {
const config = await getConfig(
{ browserslist: `defaults, ie >= 11` },
`gatsby-app`,
`build-javascript`
)

expect(config.entry.app).toEqual([
`react-app-polyfill/ie11`,
`react-app-polyfilll/ie11`,
`gatsby-app/.cache/production-app`,
])
})
Expand Down
12 changes: 6 additions & 6 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ module.exports = async (
) => {
const directoryPath = withBasePath(directory)

// Polyfil for IE support
// Polyfill for IE support
const supportedBrowsers = browserslist(program.browserslist)
let iePolyfil = false
let iePolyfill = false
if (
supportedBrowsers.includes(`ie 9`) ||
supportedBrowsers.includes(`ie 10`)
) {
iePolyfil = `react-app-polyfill/ie9`
iePolyfill = `react-app-polyfill/ie9`
} else if (supportedBrowsers.includes(`ie 11`)) {
iePolyfil = `react-app-polyfill/ie11`
iePolyfill = `react-app-polyfill/ie11`
}

process.env.GATSBY_BUILD_STAGE = suppliedStage
Expand Down Expand Up @@ -164,7 +164,7 @@ module.exports = async (
case `develop`:
return {
commons: [
iePolyfil,
iePolyfill,
`event-source-polyfill`,
`${require.resolve(
`webpack-hot-middleware/client`
Expand All @@ -182,7 +182,7 @@ module.exports = async (
}
case `build-javascript`:
return {
app: [iePolyfil, directoryPath(`.cache/production-app`)].filter(
app: [iePolyfill, directoryPath(`.cache/production-app`)].filter(
Boolean
),
}
Expand Down

0 comments on commit 6a62d32

Please sign in to comment.