morpha
Version:
A Web-IDE or Desktop-IDE creator.
84 lines (82 loc) • 1.91 kB
JavaScript
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const rucksack = require('rucksack-css')
const autoprefixer = require('autoprefixer')
const path = require('path')
module.exports = {
context: path.join(__dirname, 'static/webpack'),
entry: {
jsx: './entry.js',
vendor: [
'react',
'react-dom',
],
},
output: {
path: path.join(__dirname, './dist'),
filename: 'index.js',
},
module: {
loaders: [
{
test: /\.html$/,
loader: 'file?name=[name].[ext]',
},
{
test: /\.json$/,
loader: 'json',
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract(
'css!less'
),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('css?sourceMap&-restructuring!' + 'postcss'),
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: [
'react-hot',
'babel-loader',
],
},
],
},
postcss: [
rucksack(),
autoprefixer({
browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8'],
}),
],
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendor', 'common.js'),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development') },
}),
/* new webpack.optimize.UglifyJsPlugin({
// compressor: {
// screw_ie8: true,
// warnings: false,
// },
}),*/
new webpack.SourceMapDevToolPlugin({
exclude: /node_modules/,
}),
new ExtractTextPlugin('index.css', {
disable: false,
allChunks: true,
}),
],
devServer: {
contentBase: './static/webpack',
hot: true,
},
}