码迷,mamicode.com
首页 > Web开发 > 详细

webpack配置

时间:2017-07-28 18:29:08      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:filename   test   build   cache   ons   use   []   copy   dex   

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配置

标签:filename   test   build   cache   ons   use   []   copy   dex   

原文地址:http://www.cnblogs.com/LSSSunshine/p/7251631.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!