ant-design/webpack.config.js

69 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-05-21 20:36:13 +08:00
var webpack = require('webpack');
2015-06-05 17:27:05 +08:00
var ExtractTextPlugin = require("extract-text-webpack-plugin");
2015-05-25 17:20:49 +08:00
var path = require('path');
2015-07-04 16:20:50 +08:00
var pkg = require('./package');
var entry = {};
2016-02-03 13:34:18 +08:00
entry['demo'] = ['./scripts/demo.js', 'webpack-hot-middleware/client'];
2015-05-21 20:36:13 +08:00
module.exports = {
2015-07-04 16:20:50 +08:00
entry: entry,
2015-05-21 20:36:13 +08:00
2016-01-30 18:40:51 +08:00
cache: true,
2015-05-21 20:36:13 +08:00
resolve: {
2016-02-02 15:53:16 +08:00
extensions: ['', '.js', '.jsx'],
unsafeCache: true
2015-05-21 20:36:13 +08:00
},
2016-01-30 18:40:51 +08:00
noParse: /_site|node_modules/,
2015-05-21 20:36:13 +08:00
output: {
2015-05-25 17:20:49 +08:00
path: path.join(process.cwd(), 'dist'),
2016-02-03 13:34:18 +08:00
publicPath: '/dist/',
2015-10-20 16:47:55 +08:00
filename: '[name].js'
2015-05-21 20:36:13 +08:00
},
module: {
2015-06-11 11:38:53 +08:00
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'es3ify',
}, {
2015-06-11 11:38:53 +08:00
test: /\.jsx?$/,
exclude: /node_modules/,
2015-12-03 15:23:54 +08:00
loader: 'babel',
query: {
2016-02-03 11:40:18 +08:00
cacheDirectory: true,
2016-02-11 21:53:54 +08:00
presets: ['es2015', 'react', 'stage-0', 'react-hmre'],
plugins: ['add-module-exports']
2015-12-03 15:23:54 +08:00
}
2015-06-11 11:38:53 +08:00
}, {
test: /\.json$/,
2016-01-30 18:40:51 +08:00
exclude: /node_modules/,
2015-06-11 11:38:53 +08:00
loader: 'json-loader'
}, {
test: /\.less$/,
2016-01-30 18:40:51 +08:00
exclude: /node_modules/,
2015-06-11 11:38:53 +08:00
loader: ExtractTextPlugin.extract(
'css?sourceMap&-minimize!' + 'postcss-loader!' + 'less?sourceMap'
2015-06-11 11:38:53 +08:00
)
}, {
test: /\.css$/,
2016-01-30 18:40:51 +08:00
exclude: /node_modules/,
2015-06-11 11:38:53 +08:00
loader: ExtractTextPlugin.extract(
'css?sourceMap&-minimize!' + 'postcss-loader'
2015-06-11 11:38:53 +08:00
)
}]
2015-05-21 20:36:13 +08:00
},
2015-05-25 17:28:22 +08:00
2015-06-05 17:27:05 +08:00
plugins: [
2016-02-03 13:34:18 +08:00
new ExtractTextPlugin('[name].css'),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
2015-06-16 20:10:30 +08:00
],
devtool: 'source-map'
2015-05-21 20:36:13 +08:00
};