element/build/cooking.test.js

53 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-10-11 19:00:37 +08:00
var cooking = require('cooking');
var config = require('./config');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
2016-10-20 08:50:40 +08:00
var jsLoader = process.env.CI_ENV ? 'isparta-loader' : 'isparta-loader!eslint-loader';
2016-10-11 19:00:37 +08:00
cooking.set({
entry: './src/index.js',
2016-10-20 08:50:40 +08:00
extends: process.env.CI_ENV ? ['vue2'] : ['vue2', 'lint'],
2016-10-11 19:00:37 +08:00
minimize: false,
2016-10-25 21:35:41 +08:00
alias: Object.assign(config.alias, {
'vue$': 'vue/dist/vue.js'
}),
2016-11-05 23:14:23 +08:00
postcss: function(webapck) {
return [
require('postcss-salad')({
browsers: ['ie > 8', 'last 2 versions', 'Chrome > 24'],
features: {
'partialImport': {
addDependencyTo: webapck
},
'bem': {
'shortcuts': {
'component': 'b',
'modifier': 'm',
'descendent': 'e'
},
'separators': {
'descendent': '__',
'modifier': '--'
}
}
}
})
];
},
2016-10-11 19:00:37 +08:00
sourceMap: '#inline-source-map'
});
2016-10-20 08:50:40 +08:00
cooking.add('vue.loaders.js', jsLoader);
2016-10-11 19:00:37 +08:00
cooking.add('loader.js.exclude', config.jsexclude);
2016-10-20 08:50:40 +08:00
cooking.add('preLoader.0', {
2016-10-11 19:00:37 +08:00
test: /\.js$/,
2016-10-20 08:50:40 +08:00
loader: 'isparta',
exclude: config.jsexclude,
include: /src|packages/
2016-10-11 19:00:37 +08:00
});
2016-10-20 08:50:40 +08:00
if (!process.env.CI_ENV) {
cooking.add('plugins.process', new ProgressBarPlugin());
}
2016-10-22 00:45:18 +08:00
cooking.add('vue.preserveWhitespace', false);
2016-10-11 19:00:37 +08:00
module.exports = cooking.resolve();