Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.

Commit 647d53e

Browse files
committed
feat: add Gatsby plugin
1 parent 21e70d2 commit 647d53e

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

packages/gatsby-plugin/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# @bundle-analyzer/gatsby-plugin
2+
3+
Official Gatsby plugin for with [Bundle Analyzer service](https://www.bundle-analyzer.com).
4+
5+
## Install
6+
7+
```
8+
npm install --save-dev @bundle-analyzer/gatsby-plugin
9+
```
10+
11+
## Usage
12+
13+
**gatsby-config.js**
14+
15+
```js
16+
plugins: [
17+
{
18+
resolve: '@bundle-analyzer/gatsby-plugin',
19+
options: { token: '<repository-token>' },
20+
},
21+
]
22+
```
23+
24+
## Options
25+
26+
### token
27+
28+
You can specify the token using options or environment variable `BUNDLE_ANALYZER_TOKEN`.
29+
30+
### configFile
31+
32+
You can specify a custom configuration file.
33+
34+
## Complete documentation
35+
36+
👉 [See full documentation](https://docs.bundle-analyzer.com/)
37+
38+
## License
39+
40+
MIT

packages/gatsby-plugin/gatsby-node.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line import/no-unresolved
2+
module.exports = require('./lib/gatsby-node')

packages/gatsby-plugin/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// noop

packages/gatsby-plugin/package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "@bundle-analyzer/gatsby-plugin",
3+
"description": "Bundle Analyzer Gatsby plugin.",
4+
"version": "0.3.1",
5+
"main": "index.js",
6+
"repository": "https://github.com/smooth-code/bundle-analyzer-javascript/tree/master/packages/gatsby-plugin",
7+
"author": "Greg Bergé <[email protected]>",
8+
"publishConfig": {
9+
"access": "public"
10+
},
11+
"keywords": [
12+
"gatsby",
13+
"gatsby-plugin",
14+
"bundle-analyzer",
15+
"bundlesize"
16+
],
17+
"engines": {
18+
"node": ">=8"
19+
},
20+
"license": "MIT",
21+
"scripts": {
22+
"prebuild": "rm -rf lib/",
23+
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
24+
"prepublishOnly": "yarn run build"
25+
},
26+
"dependencies": {
27+
"@bundle-analyzer/webpack-plugin": "^0.3.1"
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import BundleAnalyzerPlugin from '@bundle-analyzer/webpack-plugin'
2+
3+
exports.onCreateWebpackConfig = ({ actions }, options) => {
4+
actions.setWebpackConfig({
5+
plugins: [new BundleAnalyzerPlugin(options)],
6+
})
7+
}

0 commit comments

Comments
 (0)