mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: replace webpack with atool-build
This commit is contained in:
parent
3611c798c1
commit
17c897a61a
@ -1,7 +1,8 @@
|
||||
npm run babel
|
||||
rm -rf dist
|
||||
webpack --config webpack.antd.config.js
|
||||
rm -rf lib dist
|
||||
|
||||
npm run babel # generate /lib
|
||||
atool-build --config webpack.antd.config.js # generate /dist
|
||||
node scripts/prenpm.js
|
||||
npm publish $1 $2
|
||||
rm -rf lib
|
||||
rm -rf dist
|
||||
|
||||
rm -rf lib dist
|
||||
|
@ -1,21 +1,22 @@
|
||||
var config = require('./webpack.config');
|
||||
config.entry = {
|
||||
'antd': ['./style/index.less', './index.js']
|
||||
module.exports = function(webpackConfig) {
|
||||
webpackConfig.entry = {
|
||||
'antd': ['./style/index.less', './index.js']
|
||||
};
|
||||
webpackConfig.externals = {
|
||||
'react': {
|
||||
root: 'React',
|
||||
commonjs2: 'react',
|
||||
commonjs: 'react',
|
||||
amd: 'react'
|
||||
},
|
||||
'react-dom': {
|
||||
root: 'ReactDOM',
|
||||
commonjs2: 'react-dom',
|
||||
commonjs: 'react-dom',
|
||||
amd: 'react-dom'
|
||||
}
|
||||
};
|
||||
webpackConfig.output.library = 'antd';
|
||||
webpackConfig.output.libraryTarget = 'umd';
|
||||
return webpackConfig;
|
||||
};
|
||||
config.externals = {
|
||||
'react': {
|
||||
root: 'React',
|
||||
commonjs2: 'react',
|
||||
commonjs: 'react',
|
||||
amd: 'react'
|
||||
},
|
||||
'react-dom': {
|
||||
root: 'ReactDOM',
|
||||
commonjs2: 'react-dom',
|
||||
commonjs: 'react-dom',
|
||||
amd: 'react-dom'
|
||||
}
|
||||
};
|
||||
config.output.library = 'antd';
|
||||
config.output.libraryTarget = 'umd';
|
||||
module.exports = config;
|
||||
|
@ -1,67 +0,0 @@
|
||||
var webpack = require('webpack');
|
||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
var path = require('path');
|
||||
var pkg = require('./package');
|
||||
var autoprefixer = require('autoprefixer');
|
||||
|
||||
var entry = {};
|
||||
entry['demo'] = ['./scripts/demo.js', 'webpack-hot-middleware/client'];
|
||||
|
||||
module.exports = {
|
||||
entry: entry,
|
||||
|
||||
cache: true,
|
||||
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx'],
|
||||
unsafeCache: true
|
||||
},
|
||||
|
||||
noParse: /_site|node_modules/,
|
||||
|
||||
output: {
|
||||
path: path.join(process.cwd(), 'dist'),
|
||||
publicPath: '/dist/',
|
||||
filename: '[name].js'
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.jsx?$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel',
|
||||
query: {
|
||||
cacheDirectory: true,
|
||||
presets: ['es2015', 'react', 'stage-0', 'react-hmre'],
|
||||
plugins: ['add-module-exports']
|
||||
}
|
||||
}, {
|
||||
test: /\.json$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'json-loader'
|
||||
}, {
|
||||
test: /\.less$/,
|
||||
exclude: /node_modules/,
|
||||
loader: ExtractTextPlugin.extract(
|
||||
'css?sourceMap&-minimize!' + 'postcss-loader!' + 'less?sourceMap'
|
||||
)
|
||||
}, {
|
||||
test: /\.css$/,
|
||||
exclude: /node_modules/,
|
||||
loader: ExtractTextPlugin.extract(
|
||||
'css?sourceMap&-minimize!' + 'postcss-loader'
|
||||
)
|
||||
}]
|
||||
},
|
||||
|
||||
postcss: [autoprefixer],
|
||||
|
||||
plugins: [
|
||||
new ExtractTextPlugin('[name].css'),
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoErrorsPlugin()
|
||||
],
|
||||
|
||||
devtool: 'source-map'
|
||||
};
|
Loading…
Reference in New Issue
Block a user