Skip to content

Commit 3d50148

Browse files
committed
build with umd then cnd could be applied with vue 3
1 parent 0c5a6c4 commit 3d50148

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

Gulpfile.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const plumber = require('gulp-plumber');
44
const file = require('gulp-file');
55
const filter = require('gulp-filter');
66
const merge = require('merge-stream');
7-
const sourcemaps = require('gulp-sourcemaps');
87
const uglify = require('gulp-uglify');
98
const clean = require('gulp-clean');
109
const commonjs = require('@rollup/plugin-commonjs')
@@ -23,7 +22,8 @@ const buildPath = 'dist/';
2322
*/
2423
function bundleCommonJs(bundle) {
2524
return bundle.generate({
26-
format: 'commonjs',
25+
format: 'umd',
26+
name: 'VueAxios'
2727
});
2828
}
2929

@@ -53,12 +53,10 @@ gulp.task('build', async function () {
5353
const data = ['vue-axios.es5.js', 'vue-axios.min.js'];
5454
const streams = data.map((name) => {
5555
return file(name, generatedBundle.output.map(o => o.code).join(" "), { src: true })
56-
.pipe(plumber())
57-
// .pipe(sourcemaps.init())
58-
.pipe(f)
59-
.pipe(uglify())
60-
// .pipe(sourcemaps.write('./'))
61-
.pipe(gulp.dest(buildPath));
56+
.pipe(plumber())
57+
.pipe(f)
58+
.pipe(uglify())
59+
.pipe(gulp.dest(buildPath));
6260
});
6361

6462
return merge(streams);

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import semver from 'semver';
22

3-
(function () {
43
/**
54
* Install plugin
65
* @param app
@@ -52,8 +51,9 @@ function plugin(app, axios) {
5251
if (typeof exports == "object") {
5352
module.exports = plugin;
5453
} else if (typeof define == "function" && define.amd) {
55-
define([], function(){ return plugin });
54+
define([], function () { return plugin });
5655
} else if (window.Vue && window.axios && window.Vue.use) { // Vue.use is only available in VueJS 2.0
5756
Vue.use(plugin, window.axios);
5857
}
59-
})();
58+
59+
export default plugin;

0 commit comments

Comments
 (0)