Skip to content

Commit 368b32f

Browse files
committed
fix examples
1 parent 6a3ae80 commit 368b32f

File tree

6 files changed

+121
-195
lines changed

6 files changed

+121
-195
lines changed

.size-snapshot.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"dist/react-spring.es.js": {
3-
"bundled": 75049,
4-
"minified": 36233,
5-
"gzipped": 11210,
3+
"bundled": 74997,
4+
"minified": 36222,
5+
"gzipped": 11204,
66
"treeshaked": {
77
"rollup": 28321,
88
"webpack": 29287
99
}
1010
},
1111
"dist/react-spring.umd.js": {
12-
"bundled": 78107,
13-
"minified": 33831,
14-
"gzipped": 11256
12+
"bundled": 78055,
13+
"minified": 33820,
14+
"gzipped": 11248
1515
},
1616
"dist/addons.es.js": {
1717
"bundled": 14510,

examples/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"html-webpack-plugin": "^3.2.0",
3535
"lodash-webpack-plugin": "^0.11.4",
3636
"prop-types": "^15.6.1",
37-
"react": "^16.3.1",
38-
"react-dom": "^16.3.1",
37+
"react": "^16.3.2",
38+
"react-dom": "^16.3.2",
3939
"style-loader": "^0.20.3",
4040
"webpack": "^4.5.0",
4141
"webpack-bundle-analyzer": "^2.11.1",

examples/webpack.config.js

Lines changed: 102 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,112 @@
11
const path = require('path')
22
const HtmlWebpackPlugin = require('html-webpack-plugin')
33
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
4-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
4+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
5+
.BundleAnalyzerPlugin
56
const webpack = require('webpack')
67

78
module.exports = mode => {
8-
return {
9-
mode,
10-
entry: 'index.js',
11-
output: { filename: 'bundle.js', path: path.resolve('./dist') },
12-
module: {
13-
rules: [
14-
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
15-
{
16-
test: /\.jsx?$/,
17-
sideEffects: false,
18-
exclude: /node_modules/,
19-
use: {
20-
loader: 'babel-loader',
21-
options: {
22-
babelrc: false,
23-
presets: [
24-
[
25-
'@babel/preset-env',
26-
{
27-
modules: false,
28-
loose: true,
29-
...(mode.production
30-
? { useBuiltIns: 'usage', targets: { chrome: 61 } }
31-
: { useBuiltIns: false, targets: { browsers: 'last 2 Chrome versions' } }),
32-
},
33-
],
34-
'@babel/preset-stage-0',
35-
'@babel/preset-react',
36-
],
37-
plugins: mode.production
38-
? [
39-
[
40-
'@babel/transform-runtime',
41-
{ helpers: true, polyfill: false, regenerator: false, moduleName: '@babel/runtime' },
42-
],
43-
'babel-plugin-lodash',
44-
]
45-
: [],
46-
},
47-
},
48-
},
49-
],
50-
},
51-
resolve: {
52-
modules: [path.resolve('./'), 'node_modules'],
53-
extensions: ['.js', '.jsx'],
54-
alias: {
55-
'react': path.resolve('node_modules/react'),
56-
'react-spring': path.resolve('../src'),
57-
lodash: path.resolve(__dirname, 'node_modules/lodash-es'),
9+
return {
10+
mode,
11+
entry: 'index.js',
12+
output: { filename: 'bundle.js', path: path.resolve('./dist') },
13+
module: {
14+
rules: [
15+
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
16+
{
17+
test: /\.jsx?$/,
18+
sideEffects: false,
19+
exclude: /node_modules/,
20+
use: {
21+
loader: 'babel-loader',
22+
options: {
23+
babelrc: false,
24+
presets: [
25+
[
26+
'@babel/preset-env',
27+
{
28+
modules: false,
29+
loose: true,
30+
...(mode.production
31+
? { useBuiltIns: 'usage', targets: { chrome: 61 } }
32+
: {
33+
useBuiltIns: false,
34+
targets: { browsers: 'last 2 Chrome versions' },
35+
}),
36+
},
37+
],
38+
'@babel/preset-stage-0',
39+
'@babel/preset-react',
40+
],
41+
plugins: mode.production
42+
? [
43+
[
44+
'@babel/transform-runtime',
45+
{
46+
helpers: true,
47+
polyfill: false,
48+
regenerator: false,
49+
moduleName: '@babel/runtime',
50+
},
51+
],
52+
'babel-plugin-lodash',
53+
]
54+
: [],
5855
},
56+
},
5957
},
60-
plugins: [
61-
new HtmlWebpackPlugin({ template: 'template.html' }),
62-
new LodashModuleReplacementPlugin(),
63-
new webpack.LoaderOptionsPlugin({ minimize: true, debug: false }),
64-
new BundleAnalyzerPlugin({ openAnalyzer: false, analyzerMode: 'static', defaultSizes: 'gzip' }),
65-
],
66-
devServer: { hot: false, contentBase: path.resolve('./'), stats: 'errors-only' },
67-
devtool: undefined,
68-
optimization: {
69-
runtimeChunk: true,
70-
splitChunks: {
71-
chunks: 'all',
72-
minSize: 20000,
73-
minChunks: 1,
74-
maxAsyncRequests: 10,
75-
maxInitialRequests: 10,
76-
automaticNameDelimiter: '~',
77-
name: true,
78-
cacheGroups: {
79-
default: {
80-
minChunks: 1,
81-
priority: -20,
82-
reuseExistingChunk: true,
83-
},
84-
vendors: {
85-
test: /[\\/]node_modules[\\/]/,
86-
priority: -5,
87-
},
88-
},
89-
},
58+
],
59+
},
60+
resolve: {
61+
modules: [path.resolve('./'), 'node_modules'],
62+
extensions: ['.js', '.jsx'],
63+
alias: {
64+
react: path.resolve('node_modules/react'),
65+
'react-dom': path.resolve('node_modules/react-dom'),
66+
'prop-types': path.resolve('node_modules/prop-types'),
67+
'react-spring': path.resolve('../src'),
68+
lodash: path.resolve(__dirname, 'node_modules/lodash-es'),
69+
},
70+
},
71+
plugins: [
72+
new HtmlWebpackPlugin({ template: 'template.html' }),
73+
new LodashModuleReplacementPlugin(),
74+
new webpack.LoaderOptionsPlugin({ minimize: true, debug: false }),
75+
new BundleAnalyzerPlugin({
76+
openAnalyzer: false,
77+
analyzerMode: 'static',
78+
defaultSizes: 'gzip',
79+
}),
80+
],
81+
devServer: {
82+
hot: false,
83+
contentBase: path.resolve('./'),
84+
stats: 'errors-only',
85+
},
86+
devtool: undefined,
87+
optimization: {
88+
runtimeChunk: true,
89+
splitChunks: {
90+
chunks: 'all',
91+
minSize: 20000,
92+
minChunks: 1,
93+
maxAsyncRequests: 10,
94+
maxInitialRequests: 10,
95+
automaticNameDelimiter: '~',
96+
name: true,
97+
cacheGroups: {
98+
default: {
99+
minChunks: 1,
100+
priority: -20,
101+
reuseExistingChunk: true,
102+
},
103+
vendors: {
104+
test: /[\\/]node_modules[\\/]/,
105+
priority: -5,
106+
},
90107
},
91-
performance: { hints: false },
92-
}
108+
},
109+
},
110+
performance: { hints: false },
111+
}
93112
}

examples/yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5951,9 +5951,9 @@ rc@^1.1.7:
59515951
minimist "^1.2.0"
59525952
strip-json-comments "~2.0.1"
59535953

5954-
react-dom@^16.3.1:
5955-
version "16.3.1"
5956-
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.3.1.tgz#6a3c90a4fb62f915bdbcf6204422d93a7d4ca573"
5954+
react-dom@^16.3.2:
5955+
version "16.3.2"
5956+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.3.2.tgz#cb90f107e09536d683d84ed5d4888e9640e0e4df"
59575957
dependencies:
59585958
fbjs "^0.8.16"
59595959
loose-envify "^1.1.0"
@@ -5999,9 +5999,9 @@ react-with-gesture@^1.0.9:
59995999
version "1.0.9"
60006000
resolved "https://registry.yarnpkg.com/react-with-gesture/-/react-with-gesture-1.0.9.tgz#00f8a8b684149d415e078633fd88043166d8851c"
60016001

6002-
react@^16.3.1:
6003-
version "16.3.1"
6004-
resolved "https://registry.yarnpkg.com/react/-/react-16.3.1.tgz#4a2da433d471251c69b6033ada30e2ed1202cfd8"
6002+
react@^16.3.2:
6003+
version "16.3.2"
6004+
resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9"
60056005
dependencies:
60066006
fbjs "^0.8.16"
60076007
loose-envify "^1.1.0"

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
"husky": "^0.14.3",
6363
"lint-staged": "^7.0.4",
6464
"prettier": "^1.12.0",
65-
"react": "16.2.0",
66-
"react-dom": "16.2.0",
6765
"rimraf": "2.6.2",
6866
"rollup": "0.56.5",
6967
"rollup-plugin-babel": "^4.0.0-beta.4",

0 commit comments

Comments
 (0)