代码拉取完成,页面将自动刷新
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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。