ant-design/site/bisheng.config.js

91 lines
2.2 KiB
JavaScript
Raw Normal View History

const path = require('path');
2017-03-29 15:31:01 +08:00
const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default;
const isDev = process.env.NODE_ENV === 'development';
module.exports = {
2016-05-27 14:31:29 +08:00
port: 8001,
2017-02-09 16:55:29 +08:00
source: {
components: './components',
docs: './docs',
changelog: [
'CHANGELOG.zh-CN.md',
'CHANGELOG.en-US.md',
],
},
2017-01-20 11:47:08 +08:00
theme: './site/theme',
htmlTemplate: './site/theme/static/template.html',
themeConfig: {
categoryOrder: {
设计原则: 2,
Principles: 2,
2016-08-03 17:51:33 +08:00
},
2017-01-20 11:47:08 +08:00
typeOrder: {
General: 0,
Layout: 1,
Navigation: 2,
'Data Entry': 3,
'Data Display': 4,
Feedback: 5,
Localization: 6,
Other: 7,
},
docVersions: {
'0.9.x': 'http://09x.ant.design',
'0.10.x': 'http://010x.ant.design',
'0.11.x': 'http://011x.ant.design',
'0.12.x': 'http://012x.ant.design',
'1.x': 'http://1x.ant.design',
2016-08-04 10:52:09 +08:00
},
2016-08-03 17:51:33 +08:00
},
filePathMapper(filePath) {
if (filePath === '/index.html') {
return ['/index.html', '/index-cn.html'];
}
if (filePath.endsWith('/index.html')) {
return [filePath, filePath.replace(/\/index\.html$/, '-cn/index.html')];
}
if (filePath !== '/404.html' && filePath !== '/index-cn.html') {
return [filePath, filePath.replace(/\.html$/, '-cn.html')];
}
return filePath;
},
2016-06-16 09:59:14 +08:00
doraConfig: {
verbose: true,
plugins: ['dora-plugin-upload'],
},
webpackConfig(config) {
config.resolve.alias = {
2016-07-24 14:53:09 +08:00
'antd/lib': path.join(process.cwd(), 'components'),
antd: path.join(process.cwd(), 'index'),
site: path.join(process.cwd(), 'site'),
2016-07-27 15:24:43 +08:00
'react-router': 'react-router/umd/ReactRouter',
};
2017-06-16 10:56:56 +08:00
config.externals = {
'react-router-dom': 'ReactRouterDOM',
};
2017-09-11 13:55:00 +08:00
if (isDev) {
Object.assign(config.externals, {
react: 'React',
'react-dom': 'ReactDOM',
});
}
2017-06-16 10:56:56 +08:00
2016-09-08 11:09:15 +08:00
config.babel.plugins.push([
require.resolve('babel-plugin-transform-runtime'),
{
polyfill: false,
regenerator: true,
},
]);
2017-03-29 15:31:01 +08:00
config.plugins.push(new CSSSplitWebpackPlugin({ size: 4000 }));
return config;
},
htmlTemplateExtraData: {
isDev,
},
};