-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [npm] Add webpack.config.js to give UMD packaging so can be used with AMD * [npm] Add instrs to build UMD bundle * Add *~ to .gitignore as we don't want backup files * [npm] Introduce umd and min build targets building to /dist npm run build:umd && npm run build:min && cp dist/* ./targetDir
- Loading branch information
1 parent
3a155b1
commit d55b144
Showing
4 changed files
with
82 additions
and
1 deletion.
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
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
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,61 @@ | ||
/* eslint-disable flowtype/require-valid-file-annotation */ | ||
// webpack.config.js | ||
|
||
const path = require('path'); | ||
|
||
const libraryName = 'material-ui'; | ||
const outputFile = `${libraryName}.js`; | ||
|
||
const INDEX = path.join(__dirname, 'src/index.js'); | ||
const DIST = path.join(__dirname, 'dist'); | ||
|
||
const config = { | ||
entry: { | ||
'material-ui': INDEX, | ||
}, | ||
devtool: 'source-map', | ||
output: { | ||
path: DIST, | ||
filename: outputFile, | ||
library: libraryName, | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true, | ||
}, | ||
externals: [ | ||
'react-addons-create-fragment', | ||
'react-addons-transition-group', | ||
{ | ||
react: { | ||
root: 'React', | ||
commonjs2: './react', | ||
commonjs: ['./react'], | ||
amd: 'react', | ||
}, | ||
}, | ||
{ | ||
'react-dom': { | ||
root: 'ReactDOM', | ||
commonjs2: './react-dom', | ||
commonjs: ['./react-dom'], | ||
amd: 'react-dom', | ||
}, | ||
}, | ||
], | ||
|
||
module: { | ||
loaders: [ | ||
{ | ||
test: /(\.jsx|\.js)$/, | ||
loader: 'babel', | ||
exclude: /(node_modules)/, | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
root: path.resolve('./src'), | ||
extensions: ['', '.js'], | ||
}, | ||
}; | ||
|
||
module.exports = config; | ||
|