23 Star 86 Fork 37

JetLu / colloc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
JetLu 提交于 2021-04-18 02:06 . update
const path = require('path')
const webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
module.exports = ({prod} = {}) => {
const conf = {
entry: {
main: {
import: [
'@iro/wechat-adapter',
'./src/fishpond/app.ts'
],
filename: 'game.js'
},
colloc: {import: ['./src/colloc/app.ts'], filename: '[name]/game.js', dependOn: 'main'},
sudoku: {import: ['./src/sudoku/app.ts'], filename: '[name]/game.js', dependOn: 'main'},
},
experiments: {
topLevelAwait: true
},
output: {
globalObject: 'GameGlobal', // for subpackages
path: path.resolve(`dist/root`)
},
resolve: {
extensions: ['.js', '.ts'],
alias: {
'@': path.resolve('.'),
'~': path.resolve('./src'),
}
},
devtool: prod ? false : 'source-map',
stats: 'errors-only',
watch: !prod,
module: {
rules: [
{
test: /\.ts$/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true
}
},
exclude: /node_modules/
},
{
test: /\.(vert|frag|html)$/,
use: ['raw-loader'],
exclude: /node_modules/
}
]
},
plugins: [
new webpack.DefinePlugin({
PROD: JSON.stringify(prod),
CLOUD_ID: JSON.stringify('zero-7gi05c0t5d37e3cf'),
CDN: JSON.stringify('cloud://zero-7gi05c0t5d37e3cf.7a65-zero-7gi05c0t5d37e3cf-1258618978')
}),
new webpack.ProvidePlugin({
PIXI: 'pixi.js',
})
],
mode: 'development',
}
if (prod) {
conf.mode = 'production'
conf.optimization = {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: 4,
extractComments: false,
terserOptions: {
output: {
comments: false
}
},
})
]
}
} else {
conf.plugins.push(
new ProgressBarPlugin()
)
}
return conf
}
JavaScript
1
https://gitee.com/LF/colloc.git
git@gitee.com:LF/colloc.git
LF
colloc
colloc
master

搜索帮助