mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: fix webpack config
This commit is contained in:
parent
63f7a1896c
commit
431dffa116
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Router, Route, IndexRoute, Redirect, hashHistory } from 'react-router';
|
||||
import antd from '../../';
|
||||
import antd from 'antd';
|
||||
import * as utils from './utils';
|
||||
import '../common/lib';
|
||||
import App from '../component/App';
|
||||
|
@ -18,7 +18,6 @@ module.exports = function(webpackConfig) {
|
||||
BrowserDemo: 'site/component/BrowserDemo',
|
||||
};
|
||||
|
||||
if (component !== undefined) {
|
||||
const babelConfig = require('atool-build/lib/getBabelCommonConfig')();
|
||||
babelConfig.plugins.push([
|
||||
'antd',
|
||||
@ -28,22 +27,21 @@ module.exports = function(webpackConfig) {
|
||||
}
|
||||
]);
|
||||
|
||||
const componentRegExp = component && new RegExp(`components/${component.toLowerCase()}/demo/.*\.md`);
|
||||
webpackConfig.module.loaders.push({
|
||||
test: new RegExp(`components/${component}/demo/.*\.md`),
|
||||
test: component ? componentRegExp : /\.md$/,
|
||||
exclude: /node_modules/,
|
||||
loader: `babel?${JSON.stringify(babelConfig)}!antd-md`,
|
||||
});
|
||||
}
|
||||
|
||||
const exclude = [/node_modules/];
|
||||
if (component) {
|
||||
exclude.push(new RegExp(`components/${component}/demo/.*\.md`));
|
||||
}
|
||||
if (component !== undefined) {
|
||||
webpackConfig.module.loaders.push({
|
||||
test: /\.md$/,
|
||||
exclude: exclude,
|
||||
exclude: [/node_modules/, componentRegExp],
|
||||
loader: `babel!antd-md`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.ANTD === 'PRODUCTION') {
|
||||
const entry = ['./style/index.less', './index.js'];
|
||||
|
Loading…
Reference in New Issue
Block a user