add umd library build

This commit is contained in:
jingsam 2016-11-03 17:21:04 +08:00
parent 343abe50e7
commit 5e8a2915a1
8 changed files with 20605 additions and 21 deletions

View file

@ -3,5 +3,5 @@
*.yml
build/
node_modules/
local/
gulpfile.js
test/
gulpfile.js

View file

@ -0,0 +1,48 @@
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: {
main: './src/index.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: 'iview.js',
library: 'iview',
libraryTarget: 'umd',
umdNamedDefine: true
},
resolve: {
extensions: ['', '.js', '.vue']
},
module: {
loaders: [{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}, {
test: /\.css$/,
loader: 'style!css!autoprefixer'
}, {
test: /\.less$/,
loader: 'style!css!less'
}, {
test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
loader: 'url?limit=8192'
}, {
test: /\.(html|tpl)$/,
loader: 'vue-html'
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"'
}
})
]
}

View file

@ -0,0 +1,54 @@
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: {
main: './src/index.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: 'iview.min.js',
library: 'iview',
libraryTarget: 'umd',
umdNamedDefine: true
},
resolve: {
extensions: ['', '.js', '.vue']
},
module: {
loaders: [{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}, {
test: /\.css$/,
loader: 'style!css!autoprefixer'
}, {
test: /\.less$/,
loader: 'style!css!less'
}, {
test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
loader: 'url?limit=8192'
}, {
test: /\.(html|tpl)$/,
loader: 'vue-html'
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
}

20475
dist/iview.js vendored Normal file

File diff suppressed because it is too large Load diff

12
dist/iview.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -13,10 +13,13 @@
"ui",
"framework"
],
"main": "src/index.js",
"main": "dist/iview.js",
"scripts": {
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.config.js",
"build": "gulp --gulpfile build/build-style.js"
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js",
"build": "gulp --gulpfile build/build-style.js",
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",
"dist": "npm run dist:dev && npm run dist:prod"
},
"repository": {
"type": "git",
@ -31,7 +34,7 @@
"popper.js": "^0.6.4"
},
"peerDependencies": {
"vue": "^1.0.26"
"vue": "^1.0.17"
},
"devDependencies": {
"autoprefixer-loader": "^2.0.0",

View file

@ -36,22 +36,22 @@ const iview = {
Badge,
Breadcrumb,
BreadcrumbItem: Breadcrumb.Item,
Button,
iButton: Button,
ButtonGroup: Button.Group,
Card,
Checkbox,
CheckboxGroup: Checkbox.Group,
Circle,
Col,
iCol: Col,
Collapse,
Icon,
Input,
iInput: Input,
InputNumber,
LoadingBar,
Message,
Modal,
Notice,
Option,
iOption: Option,
OptionGroup: OptionGroup,
Page,
Panel: Collapse.Panel,
@ -60,7 +60,7 @@ const iview = {
Radio,
RadioGroup: Radio.Group,
Row,
Select,
iSelect: Select,
Slider,
Spin,
Step: Steps.Step,
@ -69,20 +69,12 @@ const iview = {
Tag,
Timeline,
TimelineItem: Timeline.Item,
Tooltip,
iButton: Button,
iButtonGroup: Button.Group,
iCol: Col,
iInput: Input,
iOption: Option,
iOptionGroup: OptionGroup,
iSelect: Select
Tooltip
};
const install = function (Vue) {
Object.keys(iview).forEach((key) => {
Vue.component(key, iview[name])
Vue.component(key, iview[key])
})
}