Skip to content

Commit

Permalink
Added build and minify npm scripts, references mui#262
Browse files Browse the repository at this point in the history
  • Loading branch information
ANich committed May 25, 2016
1 parent 5af6936 commit 7f46283
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
},
"homepage": "http://material-ui.com/",
"scripts": {
"build": "npm run build:icon-index && npm run build:babel && npm run build:copy-files",
"build": "npm run build:icon-index && npm run build:babel && npm run build:copy-files && npm run build:umd && npm run build:min",
"build:icon-index": "babel-node ./scripts/icon-index-generator.js",
"build:babel": "babel ./src --ignore *.spec.js --out-dir ./build",
"build:copy-files": "babel-node ./scripts/copy-files.js",
"build:umd": "cross-env NODE_ENV=development webpack src/index.js build/umd/MaterialUI.js",
"build:min": "cross-env NODE_ENV=production webpack -p src/index.js build/umd/MaterialUI.min.js",
"clean:build": "rimraf build",
"lint": "eslint src docs/src test/integration && echo \"eslint: no lint errors\"",
"prebuild": "npm run clean:build",
Expand Down
55 changes: 55 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
var webpack = require('webpack')

module.exports = {

output: {
library: 'MaterialUI',
libraryTarget: 'umd'
},

externals: [
{
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
},
'react-tap-event-plugin': {
root: 'injectTapEventPlugin',
commonjs2: 'react-tap-event-plugin',
commonjs: 'react-tap-event-plugin',
amd: 'react-tap-event-plugin'
}
}
],

module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/
}
]
},

node: {
Buffer: false
},

plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
]
}


0 comments on commit 7f46283

Please sign in to comment.