Fix import src file multiple times, fixed #634 #630

This commit is contained in:
qingwei.li 2016-10-25 15:02:45 +08:00
parent 06b2cabf6b
commit 1a4905ec11

View File

@ -1,6 +1,10 @@
var Components = require('../components.json'); var Components = require('../components.json');
var path = require('path'); var path = require('path');
var dependencies = require('../package.json').dependencies; var dependencies = require('../package.json').dependencies;
var fs = require('fs');
var utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils'));
var mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins'));
var externals = {}; var externals = {};
Object.keys(Components).forEach(function(key) { Object.keys(Components).forEach(function(key) {
@ -12,11 +16,14 @@ Object.keys(dependencies).forEach(function(key) {
externals[key] = key; externals[key] = key;
}); });
externals['element-ui/src/utils/clickoutside'] = 'element-ui/lib/utils/clickoutside'; utilsList.forEach(function(file) {
externals['element-ui/src/utils/date'] = 'element-ui/lib/utils/date'; file = path.basename(file, '.js');
externals['element-ui/src/utils/popper'] = 'element-ui/lib/utils/popper'; externals[`element-ui/src/utils/${file}`] = `element-ui/lib/utils/${file}`;
externals['element-ui/src/utils/vue-popper'] = 'element-ui/lib/utils/vue-popper'; });
externals['element-ui/src/utils/resize-event'] = 'element-ui/lib/utils/resize-event'; mixinsList.forEach(function(file) {
file = path.basename(file, '.js');
externals[`element-ui/src/mixins/${file}`] = `element-ui/lib/mixins/${file}`;
});
exports.externals = Object.assign({ exports.externals = Object.assign({
vue: 'vue' vue: 'vue'