代码拉取完成,页面将自动刷新
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: process.env.NODE_ENV || 'development',
devtool: 'source-map',
entry: './src/js/main.js',
output: {
path: path.join(__dirname, './build'),
filename: '[name]-[hash].js'
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [
{ from: './static' }
]
}),
new HtmlWebpackPlugin({
template: './src/index.handlebars',
title: false,
date: new Date().toISOString()
}),
new HtmlWebpackPlugin({
template: './src/changelog.handlebars',
filename: 'changelog.html',
title: 'Changelog',
date: new Date().toISOString(),
changelog: require('./changelog.json')
}),
new HtmlWebpackPlugin({
template: './src/documentation.handlebars',
filename: 'documentation.html',
title: 'Documentation',
date: new Date().toISOString()
}),
new HtmlWebpackPlugin({
template: './src/404.handlebars',
filename: '404.html',
title: 'Page Not Found',
date: new Date().toISOString()
}),
new HtmlWebpackPlugin({
template: './src/common-regularity.handlebars',
filename: 'common-regularity.html',
title: '常用正则表达式',
data: new Date().toISOString()
}),
new MiniCssExtractPlugin({
filename: '[name]-[hash].css'
})
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: require.resolve('snapsvg'),
loader: 'imports-loader',
options: {
wrapper: 'window',
additionalCode: 'module.exports = 0;'
}
},
{
test: /\.peg$/,
loader: require.resolve('./lib/canopy-loader')
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
{
test: /\.handlebars$/,
loader: 'handlebars-loader',
options: {
partialDirs: [path.resolve(__dirname, 'lib/partials')],
helperDirs: [path.resolve(__dirname, 'lib/helpers')],
precompileOptions: {
knownHelpersOnly: false
}
}
}
]
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。