1 Star 0 Fork 2

霜林/跳一跳H5版

forked from jsmask/跳一跳H5版 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 2.85 KB
一键复制 编辑 原始数据 按行查看 历史
jsmask 提交于 2019-12-10 11:29 . update
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const commonConfig = {
entry: {
three: './public/three.js',
main: './app.js'
},
output: {
path: path.resolve(__dirname, "./dist"),
chunkFilename: '[name].bundle.js',
filename: chunkData => chunkData.chunk.name === 'main' ? '[name].[chunkhash:12].js' : '[name].min.js',
},
resolve: {
alias: {
'@': path.resolve(__dirname, "./"),
"@css": '@/public/css',
"@images": '@/public/images',
"@fonts": '@/public/fonts',
"@src": "@/src",
"@game": "@src/game",
"@stage": "@src/stage",
"@utils": "@src/utils",
"@scene": "@src/scene",
"@block": "@src/block",
"@part": "@src/part",
"@audio": "@/public/audio"
}
},
devtool: "cheap-module-eval-source-map",
devServer: {
contentBase: "./dist",
port: 8085,
open: true
},
module: {
rules: [{
test: /\.(mp3|mp4|ogg)$/,
use: {
loader: "file-loader",
options: {
name: "[name].[hash:8].[ext]",
outputPath: "audio/"
}
}
}, {
test: /\.(jpe?g|gif|svg|png)$/,
use: {
loader: "file-loader",
options: {
name: "[name].[hash:8].[ext]",
outputPath: "images/"
}
}
}, {
test: /\.css$/,
use: ['style-loader', 'css-loader']
}, {
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
plugins: ['@babel/plugin-proposal-class-properties'],
presets: [[
'@babel/preset-env', {
targets: {
chrome: 58,
},
useBuiltIns: "usage",
corejs: 2
}
]]
}
}
}]
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: "跳一跳H5",
favicon: "./public/favicon.ico",
filename: "index.html",
template: "./public/index.html",
minify: {
removeComments: true,
collapseWhitespace: true,
minifyCSS: true
},
})
],
optimization: {
splitChunks: {
chunks: 'all'
}
},
}
module.exports = commonConfig;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/atzw1988/jump_to_h5.git
git@gitee.com:atzw1988/jump_to_h5.git
atzw1988
jump_to_h5
跳一跳H5版
master

搜索帮助