Skip to content

Commit 9d39bcb

Browse files
committed
Added config build 🚂
1 parent 722d853 commit 9d39bcb

File tree

5 files changed

+108
-0
lines changed

5 files changed

+108
-0
lines changed

‎.babelrc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "react"]
3+
}

‎.editorconfig‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig helps developers define and maintain
2+
# consistent coding styles between different editors and IDEs.
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
*.log
3+
node_modules
4+
dist
5+
lib

‎package.json‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "react-async-loading",
3+
"version": "0.1.0",
4+
"description": "Code splitting to React and Webpack",
5+
"main": "./lib/index.js",
6+
"keywords": [
7+
"hoc",
8+
"code splitting",
9+
"react",
10+
"reactjs",
11+
"webpack"
12+
],
13+
"author": "Andrey Marchenko",
14+
"license": "MIT",
15+
"scripts": {
16+
"build": "npm run build:lib && npm run build:dist",
17+
"build:lib": "babel src --out-dir lib",
18+
"build:dist": "webpack src/index.js dist/react-async-loading.min.js",
19+
"clean": "rimraf lib dist",
20+
"prepublish": "npm run clean && npm run build"
21+
},
22+
"repository": {
23+
"type": "git",
24+
"url": "https://github.com/Tom910/react-async-loading.git"
25+
},
26+
"files": [
27+
"lib",
28+
"src"
29+
],
30+
"devDependencies": {
31+
"babel-cli": "6.14.0",
32+
"babel-core": "6.14.0",
33+
"babel-loader": "6.2.5",
34+
"babel-preset-es2015": "6.14.0",
35+
"babel-preset-react": "6.11.1",
36+
"react": "15.3.1",
37+
"react-dom": "15.3.1",
38+
"rimraf": "2.5.4",
39+
"webpack": "2.1.0-beta.21"
40+
},
41+
"peerDependencies": {
42+
"react": "*"
43+
}
44+
}

‎webpack.config.js‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
var webpack = require('webpack');
2+
3+
var reactExternal = {
4+
root: 'React',
5+
commonjs2: 'react',
6+
commonjs: 'react',
7+
amd: 'react'
8+
}
9+
10+
var env = process.env.NODE_ENV;
11+
var config = {
12+
externals: {
13+
'react': reactExternal
14+
},
15+
module: {
16+
loaders: [
17+
{ test: /\.js$/, loaders: ['babel'], exclude: /node_modules/ }
18+
]
19+
},
20+
output: {
21+
library: 'ReactAsyncLoading',
22+
libraryTarget: 'umd'
23+
},
24+
plugins: [
25+
new webpack.optimize.OccurrenceOrderPlugin(),
26+
new webpack.DefinePlugin({
27+
'process.env.NODE_ENV': JSON.stringify(env)
28+
}),
29+
new webpack.optimize.UglifyJsPlugin({
30+
compressor: {
31+
pure_getters: true,
32+
unsafe: true,
33+
unsafe_comps: true,
34+
screw_ie8: true,
35+
warnings: false
36+
}
37+
})
38+
]
39+
};
40+
41+
module.exports = config;

0 commit comments

Comments
 (0)