1 Star 0 Fork 0

WebChn/happymmall

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
WebChn 提交于 2019-08-28 07:41 . 初始化
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: './src/app.jsx',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
filename: 'js/app.js'
},
module: {
// react(jsx)语法处理
rules: [
{
test: /\.jsx$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env', 'react']
}
}
},
// css文件处理
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
},
// sass的处理
// {
// test: /\.scss$/,
// use: ExtractTextPlugin.extract({
// fallback: 'style-loader',
// use: ['css-loader', 'sass-loader']
// })
// },
// 图片的处理
{
test: /\.(png|jpg|gif)$/i,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
name: 'resource/[name].[ext]'
},
},
],
},
// 字体图标的处理
{
test: /\.(woff|woff2|eot|ttf|svg|otf)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
name: 'resource/[name].[ext]'
},
},
],
}
]
},
devServer: {
// contentBase: './dist'
port: 8086
},
plugins: [
// 处理html文件
new HtmlWebpackPlugin({
template: "./src/index.html"
}),
// 独立css文件
new ExtractTextPlugin("css/[name].css"),
// 提出公共模块 webpack自带
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: 'js/base/js'
})
]
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/WebJianHong/happymmall.git
git@gitee.com:WebJianHong/happymmall.git
WebJianHong
happymmall
happymmall
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385