Skip to content

Commit

Permalink
fix(project): fix build for iOS 13
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristiaanScheermeijer committed Aug 4, 2021
1 parent 9b9bf59 commit f84c8b7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"yup": "^0.32.9"
},
"devDependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.14.5",
"@commitlint/cli": "^12.1.1",
Expand All @@ -58,14 +60,14 @@
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@types/jest": "^26.0.22",
"@types/jwplayer": "^8.2.7",
"@types/lodash.merge": "^4.6.6",
"@types/react": "^17.0.14",
"@types/react-dom": "^17.0.9",
"@types/react-helmet": "^6.1.2",
"@types/react-router-dom": "^5.1.8",
"@types/react-virtualized": "^9.21.12",
"@types/snowpack-env": "^2.3.4",
"@types/jwplayer": "^8.2.7",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"codeceptjs": "^3.0.7",
Expand Down Expand Up @@ -106,5 +108,9 @@
"src/**/*.scss": [
"stylelint"
]
}
},
"browserslist": [
"defaults",
"not IE 11"
]
}
17 changes: 17 additions & 0 deletions snowpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ module.exports = {
'@snowpack/plugin-sass',
['@snowpack/plugin-webpack', {
extendConfig: (config) => {
// FIXES https://github.com/snowpackjs/snowpack/discussions/2810
const babelRule = config.module.rules.find((rule) =>
rule && rule.use && rule.use.find((use) => use && use.loader && use.loader.includes('babel-loader')));

const cssModulesRule = config.module.rules.find((rule) =>
rule && rule.use && rule.use.find((use) => use && use.loader && use.loader.includes('css-loader') && use.options && use.options.modules));

Expand All @@ -23,6 +27,19 @@ module.exports = {
});
}

if (babelRule) {
babelRule.use = babelRule.use.filter(use => {
if (use.loader.includes('babel-loader')) {
use.options.plugins = (use.options.plugins || []).concat([
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator'
]);
}

return true;
});
}

config.plugins.push(new WorkboxPlugin.GenerateSW())

return config;
Expand Down

0 comments on commit f84c8b7

Please sign in to comment.