//webpcak.config.js(文章为单入口,多入口许自己配置)
const path=require("path")
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports={
entry:{
index:'./src/index.js'
},
output:{
filename:'[name].bundle.js',
path:path.resolve(__dirname,'dist'),
clean:true
},
module:{
rules:[
{
test: /\.scss$/,
use: [
{loader:'style-loader'},
{
loader: 'css-loader',
}, {
loader: 'resolve-url-loader',
}, {
loader: 'sass-loader',
options: {
sourceMap: true, // <-- !!IMPORTANT!!
}
}
]
},
{ test: /\.handlebars$/i, loader: "handlebars-loader" },
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
]
},
plugins: [new HtmlWebpackPlugin({
})],
devServer: {
static: './dist',
},
optimization: {
runtimeChunk: 'single',
},
mode:'development',
}