mirror of
https://github.com/zhigang1992/examples.git
synced 2026-01-12 17:13:21 +08:00
refactor(with-preact): upgrade to sdk 37
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
# Preact Example
|
||||
|
||||
<p>
|
||||
<!-- Web -->
|
||||
<img alt="Supports Expo Web" longdesc="Supports Expo Web" src="https://img.shields.io/badge/web-4630EB.svg?style=flat-square&logo=GOOGLE-CHROME&labelColor=4285F4&logoColor=fff" />
|
||||
</p>
|
||||
|
||||
> 💡 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**
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user