forked from reactjs/react-modal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to using webpack for building the library
This allows us to remove the dependency on browserify completely.
- Loading branch information
1 parent
fe46c63
commit 72c8498
Showing
5 changed files
with
50 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "react"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,2 @@ | ||
#!/bin/sh | ||
mkdir -p dist | ||
NODE_ENV=production node_modules/.bin/browserify lib/index.js \ | ||
-t reactify \ | ||
-t browserify-shim \ | ||
-t envify \ | ||
--detect-globals false \ | ||
-s ReactModal > dist/react-modal.js | ||
node_modules/.bin/uglifyjs dist/react-modal.js \ | ||
--compress warnings=false > dist/react-modal.min.js | ||
|
||
webpack --config webpack.dist.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var webpack = require('webpack'); | ||
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin; | ||
var env = process.env.WEBPACK_ENV; | ||
|
||
module.exports = { | ||
|
||
entry: { | ||
'react-modal': './lib/index.js', | ||
'react-modal.min': './lib/index.js' | ||
}, | ||
|
||
output: { | ||
filename: '[name].js', | ||
chunkFilename: '[id].chunk.js', | ||
path: 'dist', | ||
publicPath: '/', | ||
libraryTarget: 'umd', | ||
library: 'ReactModal' | ||
}, | ||
|
||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) | ||
}), | ||
new UglifyJsPlugin({ | ||
include: /\.min\.js$/, | ||
minimize: true, | ||
compress: { | ||
warnings: false | ||
} | ||
}) | ||
], | ||
|
||
module: { | ||
loaders: [ | ||
{ test: /\.js?$/, exclude: /node_modules/, loader: 'babel'}, | ||
] | ||
} | ||
|
||
}; |