add umd library build
This commit is contained in:
parent
343abe50e7
commit
5e8a2915a1
8 changed files with 20605 additions and 21 deletions
|
@ -3,5 +3,5 @@
|
|||
*.yml
|
||||
build/
|
||||
node_modules/
|
||||
local/
|
||||
test/
|
||||
gulpfile.js
|
48
build/webpack.dist.dev.config.js
Normal file
48
build/webpack.dist.dev.config.js
Normal 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"'
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
54
build/webpack.dist.prod.config.js
Normal file
54
build/webpack.dist.prod.config.js
Normal 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
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
12
dist/iview.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
package.json
11
package.json
|
@ -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",
|
||||
|
|
22
src/index.js
22
src/index.js
|
@ -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])
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue