fix: graphics on server
This commit is contained in:
parent
5d322460d3
commit
eb6309f11f
|
@ -4,15 +4,16 @@ module.exports = require('@latus/build/build/.neutrinorc.js');
|
|||
|
||||
const code = [
|
||||
"if ('client' !== process.env.SIDE) {",
|
||||
"('undefined' !== typeof __non_webpack_require__ ? __non_webpack_require__ : require)('pirates').addHook(",
|
||||
"(code, filename) => '',",
|
||||
"{",
|
||||
"ignoreNodeModules: false,",
|
||||
"matcher: (filename) => filename.match('@pixi')",
|
||||
"}",
|
||||
")",
|
||||
" // eslint-disable-next-line no-eval",
|
||||
" eval('require')('pirates').addHook(",
|
||||
" () => '',",
|
||||
" {",
|
||||
" ignoreNodeModules: false,",
|
||||
" matcher: (filename) => filename.match('@pixi'),",
|
||||
" },",
|
||||
" );",
|
||||
"}",
|
||||
].join('');
|
||||
].join('\n');
|
||||
|
||||
module.exports.use.push(banner({
|
||||
banner: code,
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
"@avocado/traits": "^2.0.0",
|
||||
"@latus/core": "^2.0.0",
|
||||
"@latus/socket": "2.0.0",
|
||||
"@neutrinojs/banner": "^9.5.0",
|
||||
"@pixi/constants": "^5.3.6",
|
||||
"@pixi/core": "^5.3.6",
|
||||
"@pixi/display": "^5.3.6",
|
||||
|
|
38
packages/graphics/src/build.js
Normal file
38
packages/graphics/src/build.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const banner = require('@neutrinojs/banner');
|
||||
|
||||
module.exports = (server) => {
|
||||
server.use.unshift((neutrino) => {
|
||||
[
|
||||
'@pixi/constants$',
|
||||
'@pixi/core$',
|
||||
'@pixi/display$',
|
||||
'@pixi/filter-adjustment$',
|
||||
'@pixi/filter-advanced-bloom$',
|
||||
'@pixi/filter-color-matrix$',
|
||||
'@pixi/filter-glow$',
|
||||
'@pixi/graphics$',
|
||||
'@pixi/math$',
|
||||
'@pixi/settings$',
|
||||
'@pixi/sprite$',
|
||||
'@pixi/text$',
|
||||
].forEach((path) => {
|
||||
neutrino.config.resolve.alias
|
||||
// eslint-disable-next-line no-eval
|
||||
.set(path, eval('require').resolve('@latus/core'));
|
||||
});
|
||||
});
|
||||
const code = [
|
||||
'// eslint-disable-next-line no-eval',
|
||||
'eval(\'require\')(\'pirates\').addHook(',
|
||||
' () => \'\',',
|
||||
' {',
|
||||
' ignoreNodeModules: false,',
|
||||
' matcher: (filename) => filename.match(\'@pixi\'),',
|
||||
' },',
|
||||
');',
|
||||
].join('\n');
|
||||
server.use.unshift(banner({
|
||||
banner: code,
|
||||
pluginId: 'pixi-stub-banner',
|
||||
}));
|
||||
};
|
|
@ -1,5 +1,7 @@
|
|||
import {gatherWithLatus} from '@latus/core';
|
||||
|
||||
import build from './build';
|
||||
|
||||
export {default as Canvas} from './canvas';
|
||||
export {default as Color} from './color';
|
||||
export {default as Container} from './container';
|
||||
|
@ -32,6 +34,9 @@ export default {
|
|||
'@avocado/traits/traits': gatherWithLatus(
|
||||
require.context('./traits', false, /\.js$/),
|
||||
),
|
||||
'@latus/core/build': ({server}) => {
|
||||
build(server);
|
||||
},
|
||||
'@latus/socket/packets': gatherWithLatus(
|
||||
require.context('./packets', false, /\.js$/),
|
||||
),
|
||||
|
|
0
packages/graphics/src/stub.js
Normal file
0
packages/graphics/src/stub.js
Normal file
|
@ -1082,7 +1082,7 @@
|
|||
eslint-plugin-react "^7.21.5"
|
||||
eslint-plugin-react-hooks "^4.2.0"
|
||||
|
||||
"@neutrinojs/banner@^9.4.0":
|
||||
"@neutrinojs/banner@^9.4.0", "@neutrinojs/banner@^9.5.0":
|
||||
version "9.5.0"
|
||||
resolved "http://npm.cha0sdev/@neutrinojs%2fbanner/-/banner-9.5.0.tgz#ee8df39db5d76033211a1811428e444a06d7222f"
|
||||
integrity sha512-SL4nT0V1Wykf+LcRlCp/L8Frt4dk7MZITToC+OeDz2w6V7gg8YfEwDfdEg+aampjyUoxaq+A02ZyZP1TyRDtLA==
|
||||
|
|
Loading…
Reference in New Issue
Block a user