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

Commit 11bca44

Browse files
committed
Webpack config
1 parent 197e2a9 commit 11bca44

File tree

6 files changed

+2904
-797
lines changed

6 files changed

+2904
-797
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"presets": [ "stage-0", "react", "es2015" ],
3-
"plugins": ["transform-class-properties", "transform-flow-strip-types"]
3+
"plugins": ["transform-class-properties", "transform-flow-strip-types", "transform-runtime"]
44
}

.flowconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[ignore]
22
.*/node_modules/fbjs/.*
3+
.*/node_modules/chalk/.*
34

45
[include]
56

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
npm-debug.log
44
.DS_Store
55
.cache
6+
dist

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@
1616
"babel-cli": "6.24.1",
1717
"babel-core": "6.25.0",
1818
"babel-eslint": "7.2.2",
19+
"babel-loader": "^7.0.0",
1920
"babel-plugin-transform-class-properties": "6.24.1",
2021
"babel-plugin-transform-flow-strip-types": "6.22.0",
22+
"babel-plugin-transform-runtime": "6.23.0",
2123
"babel-preset-es2015": "6.24.1",
2224
"babel-preset-react": "6.24.1",
2325
"babel-preset-stage-0": "6.24.1",
2426
"eslint": "4.1.1",
2527
"eslint-plugin-flowtype": "2.34.0",
2628
"eslint-plugin-react": "7.1.0",
27-
"flow-bin": "0.49.1"
29+
"flow-bin": "0.49.1",
30+
"flow-webpack-plugin": "^0.3.6",
31+
"react": "16.2.0",
32+
"webpack": "^3.0.0"
2833
},
2934
"dependencies": {
3035
"lodash": "4.17.4",
@@ -37,6 +42,7 @@
3742
"compile": "babel src -d lib/",
3843
"prepublish": "npm run compile",
3944
"build": "npm run lint && npm run flow",
45+
"build:prod": "npx webpack",
4046
"flow": "flow",
4147
"lint": "eslint src/**/*.js"
4248
}

webpack.config.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const path = require("path");
2+
const FlowWebpackPlugin = require("flow-webpack-plugin");
3+
4+
module.exports = {
5+
entry: {
6+
main: "./src/grapher.js",
7+
},
8+
output: {
9+
path: path.resolve(__dirname, "dist"),
10+
filename: "graphy.js",
11+
libraryTarget: "var",
12+
library: "Graphy",
13+
},
14+
plugins: [new FlowWebpackPlugin()],
15+
module: {
16+
rules: [
17+
{
18+
test: /\.jsx?$/,
19+
exclude: /node_modules/,
20+
use: [
21+
{
22+
loader: "babel-loader",
23+
},
24+
],
25+
},
26+
],
27+
},
28+
};

0 commit comments

Comments
 (0)