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
|
*.yml
|
||||||
build/
|
build/
|
||||||
node_modules/
|
node_modules/
|
||||||
local/
|
test/
|
||||||
gulpfile.js
|
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",
|
"ui",
|
||||||
"framework"
|
"framework"
|
||||||
],
|
],
|
||||||
"main": "src/index.js",
|
"main": "dist/iview.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.config.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"
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -31,7 +34,7 @@
|
||||||
"popper.js": "^0.6.4"
|
"popper.js": "^0.6.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "^1.0.26"
|
"vue": "^1.0.17"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer-loader": "^2.0.0",
|
"autoprefixer-loader": "^2.0.0",
|
||||||
|
|
22
src/index.js
22
src/index.js
|
@ -36,22 +36,22 @@ const iview = {
|
||||||
Badge,
|
Badge,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
BreadcrumbItem: Breadcrumb.Item,
|
BreadcrumbItem: Breadcrumb.Item,
|
||||||
Button,
|
iButton: Button,
|
||||||
ButtonGroup: Button.Group,
|
ButtonGroup: Button.Group,
|
||||||
Card,
|
Card,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
CheckboxGroup: Checkbox.Group,
|
CheckboxGroup: Checkbox.Group,
|
||||||
Circle,
|
Circle,
|
||||||
Col,
|
iCol: Col,
|
||||||
Collapse,
|
Collapse,
|
||||||
Icon,
|
Icon,
|
||||||
Input,
|
iInput: Input,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
LoadingBar,
|
LoadingBar,
|
||||||
Message,
|
Message,
|
||||||
Modal,
|
Modal,
|
||||||
Notice,
|
Notice,
|
||||||
Option,
|
iOption: Option,
|
||||||
OptionGroup: OptionGroup,
|
OptionGroup: OptionGroup,
|
||||||
Page,
|
Page,
|
||||||
Panel: Collapse.Panel,
|
Panel: Collapse.Panel,
|
||||||
|
@ -60,7 +60,7 @@ const iview = {
|
||||||
Radio,
|
Radio,
|
||||||
RadioGroup: Radio.Group,
|
RadioGroup: Radio.Group,
|
||||||
Row,
|
Row,
|
||||||
Select,
|
iSelect: Select,
|
||||||
Slider,
|
Slider,
|
||||||
Spin,
|
Spin,
|
||||||
Step: Steps.Step,
|
Step: Steps.Step,
|
||||||
|
@ -69,20 +69,12 @@ const iview = {
|
||||||
Tag,
|
Tag,
|
||||||
Timeline,
|
Timeline,
|
||||||
TimelineItem: Timeline.Item,
|
TimelineItem: Timeline.Item,
|
||||||
Tooltip,
|
Tooltip
|
||||||
|
|
||||||
iButton: Button,
|
|
||||||
iButtonGroup: Button.Group,
|
|
||||||
iCol: Col,
|
|
||||||
iInput: Input,
|
|
||||||
iOption: Option,
|
|
||||||
iOptionGroup: OptionGroup,
|
|
||||||
iSelect: Select
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const install = function (Vue) {
|
const install = function (Vue) {
|
||||||
Object.keys(iview).forEach((key) => {
|
Object.keys(iview).forEach((key) => {
|
||||||
Vue.component(key, iview[name])
|
Vue.component(key, iview[key])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue