2016-09-26 19:01:53 +08:00
|
|
|
var path = require('path');
|
2016-10-25 15:02:45 +08:00
|
|
|
var fs = require('fs');
|
2016-11-13 22:08:38 +08:00
|
|
|
var nodeExternals = require('webpack-node-externals');
|
|
|
|
var Components = require('../components.json');
|
|
|
|
var saladConfig = require('../packages/theme-default/salad.config.json');
|
2016-10-25 15:02:45 +08:00
|
|
|
|
|
|
|
var utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils'));
|
|
|
|
var mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins'));
|
2016-09-26 19:01:53 +08:00
|
|
|
var externals = {};
|
|
|
|
|
|
|
|
Object.keys(Components).forEach(function(key) {
|
2016-10-25 21:35:41 +08:00
|
|
|
externals[`element-ui/packages/${key}`] = `element-ui/lib/${key}`;
|
2016-09-26 19:01:53 +08:00
|
|
|
});
|
2016-10-17 17:47:24 +08:00
|
|
|
|
2016-11-13 22:08:38 +08:00
|
|
|
externals['element-ui/src/locale'] = 'element-ui/lib/locale';
|
2016-10-25 15:02:45 +08:00
|
|
|
utilsList.forEach(function(file) {
|
|
|
|
file = path.basename(file, '.js');
|
|
|
|
externals[`element-ui/src/utils/${file}`] = `element-ui/lib/utils/${file}`;
|
|
|
|
});
|
|
|
|
mixinsList.forEach(function(file) {
|
|
|
|
file = path.basename(file, '.js');
|
|
|
|
externals[`element-ui/src/mixins/${file}`] = `element-ui/lib/mixins/${file}`;
|
|
|
|
});
|
2016-10-10 11:33:24 +08:00
|
|
|
|
2016-11-13 22:08:38 +08:00
|
|
|
externals = [Object.assign({
|
2016-10-17 17:47:24 +08:00
|
|
|
vue: 'vue'
|
2016-11-13 22:08:38 +08:00
|
|
|
}, externals), nodeExternals()];
|
|
|
|
|
|
|
|
exports.externals = externals;
|
2016-09-26 19:01:53 +08:00
|
|
|
|
|
|
|
exports.alias = {
|
|
|
|
main: path.resolve(__dirname, '../src'),
|
|
|
|
packages: path.resolve(__dirname, '../packages'),
|
2016-10-13 11:12:24 +08:00
|
|
|
examples: path.resolve(__dirname, '../examples'),
|
|
|
|
'element-ui': path.resolve(__dirname, '../')
|
2016-09-26 19:01:53 +08:00
|
|
|
};
|
|
|
|
|
2016-10-17 17:47:24 +08:00
|
|
|
exports.vue = {
|
|
|
|
root: 'Vue',
|
|
|
|
commonjs: 'vue',
|
|
|
|
commonjs2: 'vue',
|
|
|
|
amd: 'vue'
|
|
|
|
};
|
|
|
|
|
2016-09-26 19:01:53 +08:00
|
|
|
exports.jsexclude = /node_modules|utils\/popper\.js|utils\/date.\js/;
|
2016-10-11 19:00:37 +08:00
|
|
|
|
|
|
|
exports.postcss = function(webapck) {
|
2016-11-13 22:08:38 +08:00
|
|
|
saladConfig.features.partialImport = {
|
|
|
|
addDependencyTo: webapck
|
|
|
|
};
|
2016-10-11 19:00:37 +08:00
|
|
|
return [
|
2016-11-13 22:08:38 +08:00
|
|
|
require('postcss-salad')(saladConfig)
|
2016-10-11 19:00:37 +08:00
|
|
|
];
|
|
|
|
};
|