mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
site: support import style respectivly
This commit is contained in:
@@ -2,14 +2,42 @@ const webpack = require('atool-build/lib/webpack');
|
||||
|
||||
module.exports = function(webpackConfig) {
|
||||
if (process.env.ANTD === 'WEBSITE') {
|
||||
const component = process.env.COMPONENT_STYLE;
|
||||
|
||||
webpackConfig.entry = {
|
||||
index: './site/entry/index.jsx',
|
||||
};
|
||||
webpackConfig.resolve.root = process.cwd();
|
||||
webpackConfig.resolve.alias = {
|
||||
antd: 'index',
|
||||
antd: process.cwd(),
|
||||
BrowserDemo: 'site/component/BrowserDemo',
|
||||
};
|
||||
|
||||
if (component !== undefined) {
|
||||
const babelConfig = require('atool-build/lib/getBabelCommonConfig')();
|
||||
babelConfig.plugins.push([
|
||||
'antd',
|
||||
{
|
||||
// style: true,
|
||||
libDir: 'components',
|
||||
}
|
||||
]);
|
||||
|
||||
webpackConfig.module.loaders.push({
|
||||
test: new RegExp(`components/${component}/demo/.*\.md`),
|
||||
loader: `babel?${JSON.stringify(babelConfig)}!antd-md`,
|
||||
});
|
||||
}
|
||||
|
||||
const exclude = [/node_modules/];
|
||||
if (component) {
|
||||
exclude.push(new RegExp(`components/${component}/demo/.*\.md`));
|
||||
}
|
||||
webpackConfig.module.loaders.push({
|
||||
test: /\.md$/,
|
||||
exclude: exclude,
|
||||
loader: `babel!antd-md`,
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.ANTD === 'PRODUCTION') {
|
||||
|
||||
Reference in New Issue
Block a user