From 8ce070ee3f72db646bcbc7fa8bb96dbe5a4a7648 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Wed, 22 Apr 2020 17:44:01 +0200 Subject: [PATCH] refactor(with-preact): upgrade to sdk 37 --- with-preact/README.md | 7 ++++++- with-preact/package.json | 15 ++++++++------- with-preact/webpack.config.js | 12 +++++++++++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/with-preact/README.md b/with-preact/README.md index 404d142..0a24a8c 100644 --- a/with-preact/README.md +++ b/with-preact/README.md @@ -1,12 +1,17 @@ # Preact Example +

+ + Supports Expo Web +

+ > 💡 The most updated info is in the Expo docs: [Using Preact](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/guides/using-preact.md) [Preact](https://preactjs.com/) is "a fast 3kB alternative to React" with the same modern API as React. Preact was created by [Jason Miller](https://twitter.com/_developit). ## Before Preact -If you create a standard Expo web project (at the time of writing this), the bundle size will look something like the report below. +If you create a standard Expo web project (at the time of writing this), the bundle size will look something like the report below. **❌ 60.75 KB Gzipped** diff --git a/with-preact/package.json b/with-preact/package.json index 45a7cf2..d2202ea 100644 --- a/with-preact/package.json +++ b/with-preact/package.json @@ -1,16 +1,17 @@ { "dependencies": { - "expo": "36.0.0", - "preact": "10.2.1", - "preact-responder-event-plugin": "1.0.14", + "expo": "37.0.7", + "preact": "10.4.1", + "preact-responder-event-plugin": "1.0.16", "react": "16.9.0", "react-dom": "16.9.0", - "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz", + "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz", "react-native-web": "0.11.7" }, "devDependencies": { - "@babel/core": "7.0.0", - "@expo/webpack-config": "0.10.11", - "babel-preset-expo": "8.0.0" + "@babel/core": "7.9.0", + "@expo/webpack-config": "0.12.0", + "babel-preset-expo": "8.1.0", + "webpack-bundle-analyzer": "3.7.0" } } diff --git a/with-preact/webpack.config.js b/with-preact/webpack.config.js index 8ee966d..2892101 100644 --- a/with-preact/webpack.config.js +++ b/with-preact/webpack.config.js @@ -1,7 +1,17 @@ const createExpoWebpackConfigAsync = require('@expo/webpack-config'); +const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); module.exports = async function(env, argv) { - const config = await createExpoWebpackConfigAsync({ ...env, report: true }, argv); + const config = await createExpoWebpackConfigAsync(env, argv); + + // see: https://expo.fyi/webpack-report-property-is-deprecated + if (env.mode === 'production') { + config.plugins.push( + new BundleAnalyzerPlugin({ + path: 'web-report', + }), + ); + } config.resolve.alias = { ...config.resolve.alias,