1

I'm trying to deploy an app that makes use of the MRE SDK to Heroku. As of this writing, the SDK itself is broken, and attempting to run an npm run build will result in an error.

A work around is to copy a modified animation.d.ts file over to the resulting node_modules folder, after the install (specifically ./node_modules/@microsoft/mixed-reality-extension-sdk/built/animation/).

I keep this file in a folder called v0.16_mre_fix.

Without this, the build will fail. So I added this to my package.json file.

"scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "clean": "tsc --build --clean",
        "heroku-postbuild": "cp -i ./v0.16_mre_fix/*.ts ./node_modules/@microsoft/mixed-reality-extension-sdk/built/animation/",
        "build": "tslint -p ./tsconfig.json src/**/*.ts && tsc --build",
        "lint": "tslint -p ./tsconfig.json src/**/*.ts",
        "start": "node .",
        "debug": "node --nolazy --inspect-brk=9229 ."
    },

According to heroku here, heroku-postbuild will be run after installing dependencies. This, however, did not work.

So I tried changing it to heroku-prebuild and postinstall:. They didn't work either.

Am I missing something?

EDIT: I also tried

"heroku-prebuild": "echo This runs before Heroku installs your dependencies.",

but I didn't see any echo in the ensuing git push.

zack_falcon
  • 4,186
  • 20
  • 62
  • 108
  • 1
    You can try 'heroku-prebuild' – Serdar Sayın Apr 21 '20 at 10:12
  • @SerdarSayın, I just did, though I'm not sure if the `node_modules` folder would exist by then, so I just added the sample code: `"heroku-prebuild": "echo This runs before Heroku installs your dependencies.",`. I didn't see any echo in the ensuing git push. Does this mean it failed? – zack_falcon Apr 21 '20 at 10:15
  • Even though I suggested to you an option, you definitely shouldn't change your node_modules folder. If you think something's wrong with the package you should create an issue or PR. – Serdar Sayın Apr 21 '20 at 10:24
  • That was actually their recommended course of action cause it's so broken LOL. I only really have to edit a certain line in the file `animation.d.ts` (remove a `readonly` that's causing issues). I just thought overwriting the file produced by node with a modified file would be easier. – zack_falcon Apr 21 '20 at 10:27
  • 1
    Argh. That's rough. I strongly disagree with doing that but if that's the case, you can build that package on your local and use it from your local file instead of using it through node modules. I need to warn you once again it's really messy and discouraged. You shouldn't use it on production. – Serdar Sayın Apr 21 '20 at 10:54
  • I followed this instructions of sorts `https://stackoverflow.com/questions/55560791/build-and-use-npm-package-locall`, and managed to pack the locally modified MRE SDK, and referenced that via `"@microsoft/mixed-reality-extension-sdk": "./microsoft-mixed-reality-extension-sdk-0.16.1.tgz",`, but it's still failing. – zack_falcon Apr 22 '20 at 03:47

0 Answers0