mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: use rollup to build component
This commit is contained in:
parent
6e35dfa177
commit
4555d82c8e
4
.babelrc
4
.babelrc
@ -6,7 +6,7 @@
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"transform-runtime",
|
||||
"transform-vue-jsx"
|
||||
"transform-vue-jsx",
|
||||
"external-helpers"
|
||||
]
|
||||
}
|
42
build/rollup.component.config.js
Normal file
42
build/rollup.component.config.js
Normal file
@ -0,0 +1,42 @@
|
||||
import path from 'path';
|
||||
import vue from 'rollup-plugin-vue';
|
||||
import alias from 'zan-rollup-plugin-alias';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import componentsConfig from '../components.json';
|
||||
|
||||
const extensions = ['.js', '.vue'];
|
||||
|
||||
export default Object.keys(componentsConfig).map(component => {
|
||||
return {
|
||||
entry: componentsConfig[component],
|
||||
targets: [
|
||||
{
|
||||
dest: path.resolve(__dirname, `../lib/${component}/index.js`),
|
||||
format: 'cjs'
|
||||
}
|
||||
],
|
||||
external: ['vue', 'vue-lazyload'],
|
||||
plugins: [
|
||||
vue(),
|
||||
babel({
|
||||
externalHelpers: true
|
||||
}),
|
||||
resolve({
|
||||
main: true,
|
||||
jsnext: true,
|
||||
extensions
|
||||
}),
|
||||
commonjs({
|
||||
extensions
|
||||
}),
|
||||
alias({
|
||||
resolve: extensions,
|
||||
'src/mixins': path.resolve(__dirname, '../packages/common/mixins'),
|
||||
'src/utils': path.resolve(__dirname, '../packages/common/utils'),
|
||||
packages: path.resolve(__dirname, '../packages')
|
||||
}),
|
||||
]
|
||||
};
|
||||
});
|
15
package.json
15
package.json
@ -11,7 +11,7 @@
|
||||
"packages"
|
||||
],
|
||||
"scripts": {
|
||||
"bootstrap": "yarn || npm i",
|
||||
"bootstrap": "yarn || npm i && cd ./packages/vant-css/ && yarn || npm i && cd ../../",
|
||||
"dev": "npm run build:file && webpack-dev-server --inline --config build/webpack.config.dev.js --content-base ./",
|
||||
"build:file": "node build/bin/build-entry.js",
|
||||
"build:utils": "cross-env BABEL_ENV=utils babel src --out-dir lib --ignore src/index.js --presets=es2015",
|
||||
@ -27,7 +27,8 @@
|
||||
"test": "karma start test/unit/karma.conf.js --single-run",
|
||||
"test:coverage": "open test/unit/coverage/lcov-report/index.html",
|
||||
"test:watch": "karma start test/unit/karma.conf.js",
|
||||
"release": "npm run bootstrap && sh build/release.sh"
|
||||
"release": "npm run bootstrap && sh build/release.sh",
|
||||
"rollup": "rollup -c ./build/rollup.component.config.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -53,6 +54,7 @@
|
||||
"babel-cli": "^6.14.0",
|
||||
"babel-core": "^6.25.0",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-module-resolver": "^2.7.1",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
"babel-plugin-transform-runtime": "^6.15.0",
|
||||
@ -60,6 +62,7 @@
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"babel-preset-es2015": "^6.16.0",
|
||||
"babel-runtime": "^6.25.0",
|
||||
"babelrc-rollup": "^3.0.0",
|
||||
"chai": "^4.1.1",
|
||||
"cheerio": "^0.22.0",
|
||||
"codecov": "^2.2.0",
|
||||
@ -97,6 +100,11 @@
|
||||
"precss": "^2.0.0",
|
||||
"progress-bar-webpack-plugin": "^1.10.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"rollup": "^0.45.2",
|
||||
"rollup-plugin-babel": "^3.0.1",
|
||||
"rollup-plugin-commonjs": "^8.1.0",
|
||||
"rollup-plugin-node-resolve": "^3.0.0",
|
||||
"rollup-plugin-vue": "^2.4.1",
|
||||
"run-sequence": "^2.1.0",
|
||||
"sinon": "^2.4.1",
|
||||
"sinon-chai": "^2.12.0",
|
||||
@ -115,6 +123,7 @@
|
||||
"webpack": "^3.5.1",
|
||||
"webpack-dev-server": "^2.7.1",
|
||||
"webpack-merge": "^4.1.0",
|
||||
"zan-doc": "0.1.12"
|
||||
"zan-doc": "0.1.12",
|
||||
"zan-rollup-plugin-alias": "1.0.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import merge from 'src/utils/merge';
|
||||
import merge from '../../utils/merge';
|
||||
import PopupManager from './popup-manager';
|
||||
import PopupContext from './popup-context';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import merge from 'src/utils/merge';
|
||||
import merge from '../../utils/merge';
|
||||
import Vue from 'vue';
|
||||
|
||||
let context;
|
@ -1,5 +1,5 @@
|
||||
import Vue from 'vue';
|
||||
import { addClass } from 'src/utils/dom';
|
||||
import { addClass } from '../../utils/dom';
|
||||
import PopupContext from './popup-context';
|
||||
|
||||
const getModal = function() {
|
Loading…
x
Reference in New Issue
Block a user