mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
Testing rspack
This commit is contained in:
parent
b8839e4e70
commit
0bbb79ee6d
4 changed files with 5474 additions and 17 deletions
60
config/rspack.config.js
Normal file
60
config/rspack.config.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
const rspack = require('@rspack/core');
|
||||
const exec = require('child_process').exec;
|
||||
|
||||
module.exports = [
|
||||
|
||||
{
|
||||
mode: 'development',
|
||||
|
||||
context: `${__dirname}/../src/`,
|
||||
|
||||
entry: {
|
||||
phaser: './phaser.js'
|
||||
},
|
||||
|
||||
devtool: 'source-map',
|
||||
|
||||
output: {
|
||||
path: `${__dirname}/../build/`,
|
||||
globalObject: 'this',
|
||||
sourceMapFilename: '[file].map',
|
||||
devtoolModuleFilenameTemplate: 'webpack:///[resource-path]', // string
|
||||
devtoolFallbackModuleFilenameTemplate: 'webpack:///[resource-path]?[hash]', // string
|
||||
filename: '[name].js',
|
||||
library: {
|
||||
name: 'Phaser',
|
||||
type: 'umd',
|
||||
umdNamedDefine: true,
|
||||
}
|
||||
},
|
||||
|
||||
performance: { hints: false },
|
||||
|
||||
plugins: [
|
||||
new rspack.DefinePlugin({
|
||||
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_DEBUG": JSON.stringify(true),
|
||||
"typeof EXPERIMENTAL": JSON.stringify(true),
|
||||
"typeof PLUGIN_3D": JSON.stringify(false),
|
||||
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
|
||||
"typeof PLUGIN_FBINSTANT": JSON.stringify(false),
|
||||
"typeof FEATURE_SOUND": JSON.stringify(true)
|
||||
}),
|
||||
{
|
||||
apply: (compiler) => {
|
||||
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
|
||||
exec('node scripts/copy-to-examples-watch.js', (err, stdout, stderr) => {
|
||||
if (stdout) process.stdout.write(stdout);
|
||||
if (stderr) process.stderr.write(stderr);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
devtool: 'source-map'
|
||||
}
|
||||
];
|
130
config/rspack.dist.config.js
Normal file
130
config/rspack.dist.config.js
Normal file
|
@ -0,0 +1,130 @@
|
|||
'use strict';
|
||||
|
||||
const rspack = require('@rspack/core');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
name: 'phaser-umd',
|
||||
mode: 'production',
|
||||
|
||||
context: `${__dirname}/../src/`,
|
||||
|
||||
entry: {
|
||||
phaser: './phaser.js',
|
||||
'phaser.min': './phaser.js',
|
||||
'phaser-arcade-physics': './phaser-arcade-physics.js',
|
||||
'phaser-arcade-physics.min': './phaser-arcade-physics.js',
|
||||
'phaser-ie9': './phaser-ie9.js',
|
||||
'phaser-ie9.min': './phaser-ie9.js'
|
||||
},
|
||||
|
||||
output: {
|
||||
path: `${__dirname}/../dist/`,
|
||||
filename: '[name].js',
|
||||
globalObject: 'this',
|
||||
library: {
|
||||
name: 'Phaser',
|
||||
type: 'umd',
|
||||
umdNamedDefine: true,
|
||||
}
|
||||
},
|
||||
|
||||
performance: { hints: false },
|
||||
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
include: /\.min\.js$/,
|
||||
parallel: true,
|
||||
extractComments: false,
|
||||
terserOptions: {
|
||||
format: {
|
||||
comments: false
|
||||
},
|
||||
compress: true,
|
||||
ie8: false,
|
||||
ecma: 5,
|
||||
warnings: false
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new rspack.DefinePlugin({
|
||||
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_DEBUG": JSON.stringify(false),
|
||||
"typeof EXPERIMENTAL": JSON.stringify(false),
|
||||
"typeof PLUGIN_3D": JSON.stringify(false),
|
||||
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
|
||||
"typeof PLUGIN_FBINSTANT": JSON.stringify(false),
|
||||
"typeof FEATURE_SOUND": JSON.stringify(true)
|
||||
}),
|
||||
|
||||
new CleanWebpackPlugin()
|
||||
]
|
||||
},
|
||||
{
|
||||
experiments: {
|
||||
outputModule: true,
|
||||
},
|
||||
|
||||
name: 'phaser-esm',
|
||||
mode: 'production',
|
||||
dependencies: [ 'phaser-umd' ],
|
||||
|
||||
context: `${__dirname}/../src/`,
|
||||
|
||||
entry: {
|
||||
'phaser.esm': './phaser-esm.js',
|
||||
'phaser.esm.min': './phaser-esm.js'
|
||||
},
|
||||
|
||||
output: {
|
||||
path: `${__dirname}/../dist/`,
|
||||
filename: '[name].js',
|
||||
library: {
|
||||
type: 'module'
|
||||
}
|
||||
},
|
||||
|
||||
performance: { hints: false },
|
||||
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
include: /\.min\.js$/,
|
||||
parallel: true,
|
||||
extractComments: false,
|
||||
terserOptions: {
|
||||
format: {
|
||||
comments: false
|
||||
},
|
||||
compress: true,
|
||||
ie8: false,
|
||||
ecma: 6,
|
||||
warnings: false
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new rspack.DefinePlugin({
|
||||
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_DEBUG": JSON.stringify(false),
|
||||
"typeof EXPERIMENTAL": JSON.stringify(false),
|
||||
"typeof PLUGIN_3D": JSON.stringify(false),
|
||||
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
|
||||
"typeof PLUGIN_FBINSTANT": JSON.stringify(false),
|
||||
"typeof FEATURE_SOUND": JSON.stringify(true)
|
||||
})
|
||||
]
|
||||
}
|
||||
];
|
5293
package-lock.json
generated
5293
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -19,12 +19,14 @@
|
|||
"scripts": {
|
||||
"beta": "npm publish --tag beta",
|
||||
"help": "node scripts/help.js",
|
||||
"build": "webpack --config config/webpack.config.js",
|
||||
"wpbuild": "webpack build --config config/webpack.config.js",
|
||||
"build": "rspack build --config config/rspack.config.js",
|
||||
"watch": "webpack --watch --config config/webpack.config.js",
|
||||
"watchns": "webpack --watch --config config/webpack-nospector.config.js",
|
||||
"buildfb": "webpack --config config/webpack.fb.config.js",
|
||||
"watchfb": "webpack --config config/webpack.fb.config.js --watch",
|
||||
"dist": "webpack --config config/webpack.dist.config.js",
|
||||
"wpdist": "webpack --config config/webpack.dist.config.js",
|
||||
"dist": "rspack --config config/rspack.dist.config.js",
|
||||
"distfb": "webpack --config config/webpack.fb.dist.config.js",
|
||||
"distfull": "npm run dist && npm run distfb",
|
||||
"plugin.cam3d": "webpack --config plugins/camera3d/webpack.config.js",
|
||||
|
@ -76,6 +78,8 @@
|
|||
"web audio"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@rspack/cli": "^1.0.3",
|
||||
"@rspack/core": "^1.0.3",
|
||||
"@types/offscreencanvas": "^2019.7.3",
|
||||
"@types/source-map": "^0.5.7",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
|
|
Loading…
Reference in a new issue