2 Star 4 Fork 2

michael / gushi_namer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.common.js 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
ymsang 提交于 2019-01-31 14:54 . paste all v2.0 version code
const path = require('path');
// const webpack = require('webpack');
// const merge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const srcPath = path.resolve(__dirname, 'src');
const dir = {
js: `${srcPath}/scripts`,
style: `${srcPath}/styles`,
imgs: `${srcPath}/images`,
};
module.exports = {
entry: {
index: [
`${dir.js}/index.js`,
],
},
externals: {
jquery: 'jQuery',
},
plugins: [
new CopyWebpackPlugin([{
from: `${dir.js}/json`,
to: './json',
}]),
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
template: `${srcPath}/index.html`,
favicon: `${dir.imgs}/favicon.png`,
minify: {
collapseWhitespace: true,
removeComments: true,
},
}),
new ExtractTextPlugin({
filename: '[name].[contenthash].css',
}),
],
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader'],
}),
// use: [
// 'style-loader',
// 'css-loader',
// 'sass-loader',
// ],
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.(png|jpg|svg|gif)$/,
use: {
loader: 'url-loader',
options: {
limit: 8192,
},
},
},
{
test: /\.html$/,
use: {
loader: 'html-loader',
},
},
],
},
};
JavaScript
1
https://gitee.com/zhaodianshiqingzuo/gushi_namer.git
git@gitee.com:zhaodianshiqingzuo/gushi_namer.git
zhaodianshiqingzuo
gushi_namer
gushi_namer
master

搜索帮助