Sign in to follow this  
stoneheart

Use pixijs with rollup

Recommended Posts

Getting error while using rollup with pixijs. rollup.config.js

default export {
  input: 'js/game.js',
  output: {
    format: 'amd',
    file: 'dist/game.js'
  }
}
//game.js

let PIXI = require('pixi.js');
PIXI.utils.sayHello();

Getting define not found error in console.

 

Share this post


Link to post
Share on other sites

If you use AMD in order to reference your modules, you should configure your rollup config in order to let it know you do this way. Here in this github issue is discussed a little bit, there are some solutions to this problems that I am sure will help you.

Although, If you can, I would recommend you to stop using require and use ES6 modules (import/export) that is an accepted standard.

PD: If you are developing on browser environment, checkout this quickstart-pixijs project, it can maybe help you too! It uses Parcel under the hood. Also, if you want to make some kind of library (as it seems in your example) is pretty easy to configure, just let me know!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.