Skip to content

Commit 06f65d4

Browse files
committed
(refactor/docs): split out bundler perf optimizations
- made a lot of iterations on the bundler perf section just to really make it explicit that it's optional, but honestly the best way to do that is to just take it out of the README entirely - now its still linked to in the README, but not attracting a lot of attention to itself - downside of this is of course that less people who need it actually see it, but better than turning off users early with lots of config - README is tiny though, so it should still be easily noticeable - and hopefully the big blue hyperlinked heading makes it easily noticeable as well, so that hopefully prunes the downside quite a bit
1 parent f292580 commit 06f65d4

File tree

2 files changed

+50
-45
lines changed

2 files changed

+50
-45
lines changed

README.md

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -52,52 +52,11 @@ npm install -D webworkify
5252

5353
See the [webpack.js](webpack.js) and [browserify.js](browserify.js) files for examples as to how one might configure for a different bundler.
5454

55-
## Bundler Performance Optimizations
55+
## [Bundler Performance Optimizations](./docs/bundler-performance-optimizations.md)
5656

57-
**Please note**: this section is entirely _optional_, it is only for advanced users and not necessary to use this library.
58-
59-
Using `physijs-webpack` may bulk up your bundle by quite a bit, primarily because `physijs` depends on `ammo.js`, which is roughly ~1.2MB (minified) alone.
60-
While caching of repeated builds will certainly speed up performance by quite a bit, we can use some other optimizations to further improve your bundler's performance.
61-
62-
### noParse
63-
64-
One of these is the `noParse` config option ([webpack](https://webpack.js.org/configuration/module/#modulenoparse)|[browserify](https://github.com/browserify/browserify#usage)) that instructs the bundler to skip parsing of certain files and is usually used as an optimization for large files (like `ammo.js`!).
65-
66-
With `webpack`, this optimization might look like:
67-
68-
```javascript
69-
// ...
70-
module.exports = {
71-
// ...
72-
module: {
73-
// don't parse ammo
74-
noParse: require.resolve('physijs-webpack/physijs/vendor/ammo.js')
75-
},
76-
// ...
77-
}
78-
```
79-
80-
And with the [`browserify` API](https://github.com/browserify/browserify#browserifyfiles--opts), this optimization might look like:
81-
82-
```javascript
83-
const browserify = require('browserify')
84-
// ...
85-
86-
browserify({
87-
// ...
88-
// don't parse ammo
89-
noParse: [require.resolve('physijs-webpack/physijs/vendor/ammo.js')],
90-
// ...
91-
})
92-
```
93-
94-
### other optimizations
95-
96-
If you are looking to speed up your build even further, you may want to look into configuring `externals` ([webpack](https://webpack.js.org/configuration/externals/)|[browserify](https://github.com/browserify/browserify#bexternalfile)) (and possibly configuring `ignore`s ([webpack](https://webpack.js.org/plugins/ignore-plugin/)|[browserify](https://github.com/browserify/browserify#bignorefile))).
97-
98-
You may also want to apply these same bundler performance optimizations to `three` as well, as it is also a fairly large library.
99-
100-
Please send a PR if you identify any other performance optimizations that you think may be useful to others!
57+
Feeling like your builds are too slow?
58+
Looking to speed them up?
59+
Check out our [optimization docs](./docs/bundler-performance-optimizations.md)!
10160

10261
## Credits
10362

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Bundler Performance Optimizations
2+
3+
**Please note**: this is entirely _optional_, it is only for advanced users and not necessary to use this library.
4+
5+
Using `physijs-webpack` may bulk up your bundle by quite a bit, primarily because `physijs` depends on `ammo.js`, which is roughly ~1.2MB (minified) alone.
6+
While caching of repeated builds will certainly speed up performance by quite a bit, we can use some other optimizations to further improve your bundler's performance.
7+
8+
## noParse
9+
10+
One of these is the `noParse` config option ([webpack](https://webpack.js.org/configuration/module/#modulenoparse)|[browserify](https://github.com/browserify/browserify#usage)) that instructs the bundler to skip parsing of certain files and is usually used as an optimization for large files (like `ammo.js`!).
11+
12+
With `webpack`, this optimization might look like:
13+
14+
```javascript
15+
// ...
16+
module.exports = {
17+
// ...
18+
module: {
19+
// don't parse ammo
20+
noParse: require.resolve('physijs-webpack/physijs/vendor/ammo.js')
21+
},
22+
// ...
23+
}
24+
```
25+
26+
And with the [`browserify` API](https://github.com/browserify/browserify#browserifyfiles--opts), this optimization might look like:
27+
28+
```javascript
29+
const browserify = require('browserify')
30+
// ...
31+
32+
browserify({
33+
// ...
34+
// don't parse ammo
35+
noParse: [require.resolve('physijs-webpack/physijs/vendor/ammo.js')],
36+
// ...
37+
})
38+
```
39+
40+
## other optimizations
41+
42+
If you are looking to speed up your build even further, you may want to look into configuring `externals` ([webpack](https://webpack.js.org/configuration/externals/)|[browserify](https://github.com/browserify/browserify#bexternalfile)) (and possibly configuring `ignore`s ([webpack](https://webpack.js.org/plugins/ignore-plugin/)|[browserify](https://github.com/browserify/browserify#bignorefile))).
43+
44+
You may also want to apply these same bundler performance optimizations to `three` as well, as it is also a fairly large library.
45+
46+
Please send a PR if you identify any other performance optimizations that you think may be useful to others!

0 commit comments

Comments
 (0)