Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

direct loading of library in README doesn't work for me #39

Open
andrewljohnson opened this issue May 12, 2021 · 0 comments
Open

direct loading of library in README doesn't work for me #39

andrewljohnson opened this issue May 12, 2021 · 0 comments

Comments

@andrewljohnson
Copy link

The Issue

This code suggested in the README doesn't seem to work for me:

<script src="/static/js/lib/pixi.js"></script>
<script src="/static/js/lib/pixi-viewport.js"></script>
<script src="/static/js/lib/scrollbox.js"></script>
<script>
    const Scrollbox = new Scrollbox(options)
</script>

I get this error: Uncaught ReferenceError: Cannot access 'Scrollbox' before initialization

Related

FWIW, I was also trying to get it to work with requireJS. I am able to get pixi, pixi-filters, and bump loading, but when I try and add in scrollbox, I get errors like Uncaught Error: Script error for "@pixi/math", needed by: pixi-viewport

Sorry if this is just me knowing nothing about node and little about JS builds, or just messing up requirejs syntax!

<script type="text/javascript">
	require.config({
	    paths: {
	        'pixi': '/static/js/lib/pixi',
	        'pixi-filters': '/static/js/lib/pixi-filters',
	        'bump': '/static/js/lib/bump',
	        'scrollbox': '/static/js/lib/scrollbox',
	        'pixi-viewport': '/static/js/lib/pixi-viewport',
	    },
		shim: {         
            'pixi-filters': {
                deps: ['pixi']
            },
            'pixi-viewport': {
                deps: ['pixi']
            },
            'scrollbox': {
                deps: ['pixi', 'pixi-viewport']
            }
        }    	    
	});

	var gameRoom;
	var gameUX;

	require(['pixi', 'pixi-filters', 'bump', 'scrollbox'], function () {
		gameUX = new GameUX();
		gameRoom = new GameRoom(gameUX);
		gameRoom.connect();
		// const Scrollbox = require('scrollbox').Scrollbox
		// const scrollbox = new Scrollbox({ boxWidth: 200, boxHeight: 200})
	});
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant