1 Star 7 Fork 7

韩子卢/resizeDiv4React

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.common.js 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
韩子卢 提交于 5年前 . 初始化
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const pathsToClean = [
'build',
];
const isProduction = process.env.NODE_ENV === 'production';
module.exports = {
entry: {
main: ['babel-polyfill', './src/app.js'],
},
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name].[chunkhash].js',
// 添加 chunkFilename
publicPath: '/',
chunkFilename: '[name].[chunkhash:5].chunk.js',
},
plugins: [
new HtmlWebpackPlugin({
template: './template/index.html',
filename: 'demo.html',
minify: {
collapseWhitespace: true,
},
hash: isProduction,
}),
new MiniCssExtractPlugin({ filename: '[name].[contenthash].css', allChunks: false }),
new CleanWebpackPlugin(pathsToClean),
],
module: {
rules: [{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['react', 'env', 'stage-0', 'stage-3'],
plugins: [
['import', { libraryName: 'antd-mobile', style: 'css' }], // `style: true` 会加载 less 文件
],
},
},
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'images/',
},
},
{
loader: 'image-webpack-loader',
options: {
bypassOnDebug: true,
},
},
],
},
{
test: /\.html$/,
use: [{
loader: 'html-loader',
options: {
minimize: true,
},
}],
}],
},
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/vvjiang/resizeDiv4React.git
git@gitee.com:vvjiang/resizeDiv4React.git
vvjiang
resizeDiv4React
resizeDiv4React
master

搜索帮助