1. 程式人生 > >webpack配置

webpack配置

cto trac ade cached mod use ttext build nor

var path = require(‘path‘); var webpack = require(‘webpack‘); var CopyWebpackPlugin = require(‘copy-webpack-plugin‘); const ExtractTextPlugin = require("extract-text-webpack-plugin"); var src = ‘./src‘; var dist = path.join(__dirname, ‘build‘);
module.exports = { entry: [‘webpack/hot/dev-server‘, ‘./src/index.js‘], output: { path: dist, filename: ‘bundle.js‘, }, module: { loaders: [{ test: /\.jsx?$/, loader: ‘babel-loader‘, query: { cacheDirectory: true,
presets: [ require.resolve(‘babel-preset-es2015‘), require.resolve(‘babel-preset-react‘) ] } }, { test: /\.css$/, loader: ‘style-loader!css-loader‘ }, { test: /\.less$/, use: ExtractTextPlugin.extract({ fallback: ‘style-loader‘, use: [‘css-loader‘, ‘less-loader‘] }) }, { test: /\.(png|jpg)$/, loader: ‘url-loader?limit=25000‘ }] }, plugins: [ new webpack.HotModuleReplacementPlugin(), new ExtractTextPlugin(‘style.css‘), new CopyWebpackPlugin( [ { context: `${src}/`, from: ‘index.html‘ } ],
{ ignore: [], copyUnmodified: true } ) ] };

webpack配置