fde31 / max-js-bundler

CLI Tool to bundle and transpile modern JS for usage in [js] and [jsui] in Max MSP. The idea is basically to support writing modern Ecmascript code alongside the usage of NPM dependencies within your code.
MIT License
23 stars 6 forks source link

Adding MAX_MSP Namespace for Max's Global Constructors, and Dependency Updates #7

Closed devanecondition closed 4 years ago

devanecondition commented 4 years ago

Some of Max's constructors (Like Buffer) are being overwritten by variables that get bundled in from third-party dependencies. This change defines all of the Max Constructors at the top of the file, namespaced inside the object MAX_MSP so that they can still be used:

const myBuffer = new MAX_MSP.Buffer('myBuffer');

I was also getting a few warnings after using the build command, so I updated the dependencies to use the latest versions. I had to make a new branch of rollup based on the latest version and then cherry-picked your commit to support the c74max format:

"rollup": "github:devanecondition/rollup#fde/max_target-latest",

fde31 commented 4 years ago

Awesome thanks much for the PR. Generally makes sense to me. Will take a closer look / review this week.

fde31 commented 4 years ago

I merged this into fde/dep_update for now. There is some more stuff to work on and I'd like to identify a general path moving forward on how to handle / separate bundling vs transpiling. Will ticket