Skip to content

Commit e1c15ab

Browse files
committed
Fix umd build and update webpack
1 parent 140fb1c commit e1c15ab

File tree

8 files changed

+1375
-1137
lines changed

8 files changed

+1375
-1137
lines changed

dist/react-tabs.js

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

dist/react-tabs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-tabs.min.js

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-tabs.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"scripts": {
77
"clean": "rimraf lib",
88
"build:commonjs": "babel src/ --out-dir lib/ --ignore __tests__,__mocks__",
9-
"build:umd": "webpack --devtool source-map --config webpack.build.js",
10-
"build:umd:min": "cross-env MINIFY=1 webpack --devtool source-map --config webpack.build.js",
9+
"build:umd": "webpack --config webpack.build.js",
10+
"build:umd:min": "cross-env MINIFY=1 webpack --config webpack.build.js",
1111
"build": "npm run clean && npm run build:commonjs",
1212
"bundle": "mkdir -p dist && npm run build:umd && npm run build:umd:min",
1313
"lint": "eslint src",
@@ -63,8 +63,9 @@
6363
"react-modal": "^1.3.0",
6464
"react-test-renderer": "^15.5.4",
6565
"rimraf": "^2.5.2",
66-
"webpack": "^1.13.1",
67-
"webpack-dev-server": "^1.14.1"
66+
"uglifyjs-webpack-plugin": "^0.4.2",
67+
"webpack": "^2.3.3",
68+
"webpack-dev-server": "^2.4.2"
6869
},
6970
"dependencies": {
7071
"classnames": "^2.2.0",

webpack.build.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
const path = require('path');
44
const webpack = require('webpack');
5+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
56

67
let COMPONENT_FILE = 'react-tabs';
78
const plugins = [];
89

910
if (process.env.MINIFY) {
10-
plugins.push(
11-
new webpack.optimize.UglifyJsPlugin()
12-
);
11+
plugins.push(new UglifyJsPlugin({ sourceMap: true }));
1312
COMPONENT_FILE += '.min';
1413
}
1514

1615
module.exports = {
1716
entry: path.join(__dirname, require(path.join(__dirname, 'package.json')).main),
1817
output: {
19-
filename: path.join(__dirname, 'dist/' + COMPONENT_FILE + '.js'),
18+
filename: COMPONENT_FILE + '.js',
19+
path: path.join(__dirname, 'dist'),
2020
library: 'ReactTabs',
2121
libraryTarget: 'umd',
2222
},
@@ -27,15 +27,21 @@ module.exports = {
2727
commonjs: 'react',
2828
amd: 'react',
2929
},
30-
'react-dom': {
31-
root: 'ReactDOM',
32-
commonjs2: 'react-dom',
33-
commonjs: 'react-dom',
34-
amd: 'react-dom',
30+
'prop-types': {
31+
root: 'PropTypes',
32+
commonjs2: 'prop-types',
33+
commonjs: 'prop-types',
34+
amd: 'prop-types',
35+
},
36+
'classnames': {
37+
root: 'classNames',
38+
commonjs2: 'classnames',
39+
commonjs: 'classnames',
40+
amd: 'classnames',
3541
},
3642
},
3743
module: {
38-
loaders: [
44+
rules: [
3945
{
4046
test: /\.js$/,
4147
exclude: /node_modules/,
@@ -44,4 +50,5 @@ module.exports = {
4450
],
4551
},
4652
plugins: plugins,
53+
devtool: 'source-map',
4754
};

webpack.config.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,23 @@ function buildEntries() {
2424
}
2525

2626
module.exports = {
27-
2827
entry: buildEntries(),
29-
3028
output: {
3129
filename: '[name].js',
3230
chunkFilename: '[id].chunk.js',
3331
path: 'examples/__build__',
3432
publicPath: '/__build__/',
3533
},
36-
3734
module: {
38-
loaders: [
35+
rules: [
3936
{
4037
test: /\.js$/,
4138
exclude: /node_modules/,
4239
loader: 'babel-loader',
4340
},
4441
],
4542
},
46-
4743
plugins: [
48-
new webpack.optimize.CommonsChunkPlugin('shared.js'),
44+
new webpack.optimize.CommonsChunkPlugin({ name: 'shared.js' }),
4945
]
50-
5146
};

0 commit comments

Comments
 (0)