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 = {};
|
|
|
|
entry[pkg.name] = './index.js';
|
|
|
|
entry[pkg.name + '-' + pkg.version] = './index.js';
|
2015-07-06 20:18:19 +08:00
|
|
|
entry['demo'] = './scripts/demo.js';
|
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
|
|
|
|
|
|
|
resolve: {
|
2015-07-14 20:16:05 +08:00
|
|
|
extensions: ['', '.js', '.jsx']
|
2015-05-21 20:36:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
2015-05-25 17:20:49 +08:00
|
|
|
path: path.join(process.cwd(), 'dist'),
|
2015-06-05 17:52:16 +08:00
|
|
|
filename: '[name].js'
|
2015-05-21 20:36:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
externals: {
|
2015-07-12 17:10:06 +08:00
|
|
|
react: "React",
|
2015-07-14 20:16:05 +08:00
|
|
|
jquery:"jQuery"
|
2015-05-21 20:36:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
2015-06-11 11:38:53 +08:00
|
|
|
loaders: [{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'babel'
|
|
|
|
}, {
|
|
|
|
test: /\.json$/,
|
|
|
|
loader: 'json-loader'
|
|
|
|
}, {
|
|
|
|
test: /\.less$/,
|
|
|
|
loader: ExtractTextPlugin.extract(
|
2015-07-15 20:54:37 +08:00
|
|
|
'css?sourceMap&-minimize!' + 'autoprefixer-loader!' + 'less?sourceMap'
|
2015-06-11 11:38:53 +08:00
|
|
|
)
|
|
|
|
}, {
|
|
|
|
test: /\.css$/,
|
|
|
|
loader: ExtractTextPlugin.extract(
|
2015-07-15 20:54:37 +08:00
|
|
|
'css?sourceMap&-minimize!' + 'autoprefixer-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: [
|
2015-06-15 16:45:02 +08:00
|
|
|
new ExtractTextPlugin('[name].css')
|
2015-06-16 20:10:30 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
devtool: 'source-map'
|
2015-05-21 20:36:13 +08:00
|
|
|
};
|