Add webpack config and npm scripts

This commit is contained in:
Leonid Logvinov 2017-05-24 12:08:15 +02:00
parent 51d54e8406
commit 91a34889f9
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
2 changed files with 51 additions and 2 deletions

View File

@ -9,6 +9,13 @@
"tokens",
"exchange"
],
"scripts": {
"clean": "shx rm -rf _bundles lib lib-esm",
"build:bundle": "webpack",
"build:commonjs": "tsc",
"build:es6": "tsc -m es6 --outDir lib-esm",
"build": "npm run clean && run-p build:*"
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x.js"
@ -17,7 +24,12 @@
"engines": {
"node": ">=6.0.0"
},
"dependencies": {
"tslint-config-0xproject": "^0.0.0"
"devDependencies": {
"awesome-typescript-loader": "^3.1.3",
"npm-run-all": "^4.0.2",
"shx": "^0.2.2",
"tslint-config-0xproject": "^0.0.0",
"typescript": "^2.3.3",
"webpack": "^2.6.0"
}
}

37
webpack.config.js Normal file
View File

@ -0,0 +1,37 @@
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: {
'0x': './src/ts/0x.js.ts',
'0x.min': './src/ts/0x.js.ts'
},
output: {
path: path.resolve(__dirname, '_bundles'),
filename: '[name].js',
libraryTarget: 'umd',
library: 'zeroEx',
umdNamedDefine: true
},
resolve: {
extensions: ['.ts', '.js']
},
devtool: 'source-map',
plugins: [
new webpack.optimize.UglifyJsPlugin({
minimize: true,
sourceMap: true,
include: /\.min\.js$/,
})
],
module: {
loaders: [{
test: /\.ts$/,
loader: 'awesome-typescript-loader',
exclude: /node_modules/,
query: {
declaration: false,
}
}]
}
}