forked from react-grid-layout/react-grid-layout
-
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.
Add browser bundle for usage with commonjs, <script> tags, etc. Fixes r…
- Loading branch information
Showing
8 changed files
with
78 additions
and
26 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
dist/ | ||
dist/* | ||
!dist/react-grid-layout.min* | ||
npm-debug.log | ||
build/ |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,47 @@ | ||
'use strict'; | ||
var webpack = require('webpack'); | ||
var fs = require('fs'); | ||
|
||
// Builds example bundles | ||
module.exports = { | ||
context: __dirname, | ||
entry: { | ||
commons: ["lodash"], | ||
}, | ||
output: { | ||
path: __dirname + "/dist", | ||
filename: "[name].bundle.js", | ||
sourceMapFilename: "[file].map", | ||
}, | ||
module: { | ||
loaders: [ | ||
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?experimental&optional=runtime'} | ||
] | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
"process.env": { | ||
NODE_ENV: JSON.stringify('development') | ||
} | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin( | ||
"commons", "commons.js"), | ||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.optimize.DedupePlugin() | ||
], | ||
resolve: { | ||
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx"], | ||
alias: {'react-grid-layout': __dirname + '/index-dev.js'} | ||
} | ||
}; | ||
|
||
// Load all entry points | ||
var files = fs.readdirSync(__dirname + '/test/examples').filter(function(element, index, array){ | ||
return element.match(/^.+\.jsx$/); | ||
}); | ||
|
||
for(var idx in files){ | ||
var file = files[idx]; | ||
var module_name = file.replace(/\.jsx$/,''); | ||
module.exports.entry[module_name] = './test/examples/' + file; | ||
} |
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,47 +1,40 @@ | ||
'use strict'; | ||
var webpack = require('webpack'); | ||
var fs = require('fs'); | ||
|
||
// Builds example bundles | ||
// Builds bundle usable <script>. Includes RGL and all deps, excluding React. | ||
module.exports = { | ||
context: __dirname, | ||
entry: { | ||
commons: ["lodash"], | ||
'react-grid-layout': './index-dev.js' | ||
}, | ||
output: { | ||
path: __dirname + "/dist", | ||
filename: "[name].bundle.js", | ||
sourceMapFilename: "[file].map", | ||
path: __dirname + "/dist", | ||
filename: "[name].min.js", | ||
libraryTarget: "umd", | ||
library: "ReactGridLayout" | ||
}, | ||
devtool: 'source-map', | ||
externals: { | ||
// React dep should be available as window.React | ||
"react": "React" | ||
}, | ||
module: { | ||
loaders: [ | ||
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?experimental&optional=runtime'} | ||
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?experimental'} | ||
] | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
"process.env": { | ||
NODE_ENV: JSON.stringify('development') | ||
NODE_ENV: JSON.stringify('production') | ||
} | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin( | ||
"commons", "commons.js"), | ||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.optimize.DedupePlugin() | ||
new webpack.optimize.DedupePlugin(), | ||
// Compress, but don't print warnings to console | ||
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}) | ||
], | ||
resolve: { | ||
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx"], | ||
alias: {'react-grid-layout': __dirname + '/index-dev.js'} | ||
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx"] | ||
} | ||
}; | ||
|
||
// Load all entry points | ||
var files = fs.readdirSync(__dirname + '/test/examples').filter(function(element, index, array){ | ||
return element.match(/^.+\.jsx$/); | ||
}); | ||
|
||
for(var idx in files){ | ||
var file = files[idx]; | ||
var module_name = file.replace(/\.jsx$/,''); | ||
module.exports.entry[module_name] = './test/examples/' + file; | ||
} |