1 Star 2 Fork 0

魏宏斌/regexper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 2.52 KB
一键复制 编辑 原始数据 按行查看 历史
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
}
}
}
]
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/weihongbin/regexper.git
git@gitee.com:weihongbin/regexper.git
weihongbin
regexper
regexper
master

搜索帮助