代码拉取完成,页面将自动刷新
const path = require('path');
const glog = require('glob');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
// const webpack = require('webpack');
module.exports = {
entry: {
index:'./src/index.js',
print:'./src/print.js',
another:'./src/another.js'
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
// publicPath:'/'
},
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
compress: true,
port: 9000,
// clientLogLevel: "none",
compress: true,
// hot: true
},
module: {
rules: [
// {
// test:/\.css$/,
// use:[
// 'style-loader',
// 'css-loader'
// ]
// },
{
test:/\.css$/,
use:ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
//如果需要,可以在 sass-loader 之前将 resolve-url-loader 链接进来
use: ['css-loader', 'sass-loader']
})
},
{
test:/\.(png|jp[e]*g|gif)$/,
use:[
{
loader:'url-loader',
options: {
name:'[name].[ext]',
limit:8000,
outputPath: 'imgaes/'
}
}
]
},
{
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
use: [
{
loader:'file-loader',
options: {
name:'[name].[ext]',
outputPath: 'font/'
}
}
]
}
]
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
title: '输出管理'
}),
new ExtractTextPlugin({
filename: '[name].css'
}),
new UglifyJSPlugin()
// 单页面程序才用模块热替换
// new webpack.HotModuleReplacementPlugin(),
]
};
function getEntries (){
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。