加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
darkwing 提交于 2017-09-25 16:59 . 20170925
var path = require('path');
var htmlWebpackPlugin = require('html-webpack-plugin');
var webpackDevServer = require('webpack-dev-server');
module.exports = {
entry: './src/components/main.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'js/[name].js'
},
module:{
rules: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
include: path.resolve(__dirname, './src'),
query: {
presets: ['env', 'react']
}
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
'postcss-loader'
]
},
{
test: /\.scss/,
use: [
'style-loader',
'css-loader',
'postcss-loader',
'sass-loader'
]
},
{
test: /\.(png|jpg)$/,
use: [
'url-loader?limit=8192&name=images/[name]-[hash:5].[ext]'
]
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
use: [
'url-loader?limit=8192&name=fonts/icons/[name].[ext]'
]
},
{
test: /\.json$/,
use: [
'json-loader'
]
}
]
},
plugins: [
new htmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html',
inject: 'body'
})
],
devServer: {
contentBase: './dist',
port: 8000
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化