Skip to content

Commit 7d206b3

Browse files
committed
Merge branch 'hotfix/compile-dist'
2 parents bba0344 + 43e0f59 commit 7d206b3

File tree

3 files changed

+52
-24
lines changed

3 files changed

+52
-24
lines changed

dist/ReactCardFlipper.js

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-card-flipper",
33
"version": "0.1.0",
44
"description": "A React card flipper component.",
5-
"main": "ReactCardFlipper.js",
5+
"main": "dist/ReactCardFlipper.js",
66
"repository": "[email protected]:factor1/react-card-flipper.git",
77
"author": "Eric Stout <[email protected]>",
88
"license": "MIT",
@@ -30,9 +30,9 @@
3030
"dependencies": {},
3131
"scripts": {
3232
"lint": "./node_modules/.bin/eslint ReactCardFlipper.js",
33-
"build": "webpack",
34-
"watch": "webpack --watch",
35-
"start": "webpack-dev-server --open",
33+
"build": "webpack --env.production --progress",
34+
"watch": "webpack --env.production=false --watch",
35+
"start": "webpack-dev-server --env.production=false --open",
3636
"test": "npm run lint && npm run build"
3737
}
3838
}

webpack.config.js

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
const path = require('path');
2+
const webpack = require('webpack');
23

3-
module.exports = {
4-
entry: ['babel-polyfill', './Test.js'],
5-
output: {
6-
filename: 'test_bundle.js',
7-
path: path.resolve(__dirname, 'tests')
8-
},
9-
devServer: {
10-
contentBase: './tests'
11-
},
12-
module: {
13-
rules: [
14-
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
15-
{
16-
test: /\.css$/,
17-
use: [
18-
'style-loader',
19-
{ loader: 'css-loader', options: { importLoaders: 1 } },
20-
'postcss-loader'
21-
]
22-
}
4+
module.exports = env => {
5+
return {
6+
entry: env.production ? ['babel-polyfill', './ReactCardFlipper.js'] : ['babel-polyfill', './Test.js'],
7+
output: {
8+
filename: env.production ? 'ReactCardFlipper.js' : 'test_bundle.js',
9+
path: env.production ? path.resolve(__dirname, 'dist') : path.resolve(__dirname, 'tests')
10+
},
11+
devServer: {
12+
contentBase: './tests'
13+
},
14+
module: {
15+
rules: [
16+
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
17+
{
18+
test: /\.css$/,
19+
use: [
20+
'style-loader',
21+
{ loader: 'css-loader', options: { importLoaders: 1 } },
22+
'postcss-loader'
23+
]
24+
}
25+
]
26+
},
27+
plugins: [
28+
env.production ? new webpack.optimize.UglifyJsPlugin() : ''
2329
]
2430
}
2531
};

0 commit comments

Comments
 (0)