Babylon.js NPM Package Template - Compilation Problem

Was trying to compile Babylon.js Template Repositories | Babylon.js Documentation from
GitHub - BabylonJS/npm-package-template

Compiled with problems:

ERROR in ./src/index.js 1:0-51
Module not found: Error: Can't resolve 'app_package' in 'C:\Users\Fiolent2\Source\Repos\npm-package-template\test_package\src'

pinging @syntheticmagus

1 Like

Hi labris,

I don’t quite repro what you’re seeing. I do see the “Module not found” error early on, but it’s just a timing error (I believe from Webpack looking for app_package results before they’ve built yet) which resolves itself within a few seconds. Thus, when I run npm run dev in the root directory and it launches a browser page, the page at first reports errors but then immediately refreshes as the timing works itself out. Does the message you posted above pass quickly, or does it stick around?

I’ve also never seen the “This is not the tsc command you are looking for” message, but it looks like it may indicate something off in the installation. Do you perhaps have TypeScript or tsc installed globally?

1 Like

I do have TypeScript globally.
Seems the problem may relate to some paths variables - javascript - NPM: Field 'browser' doesn't contain a valid alias configuration - Stack Overflow

1 Like

Sounds good! If you find there’s a better way we should rephrase command to make sure it invokes the correct TypeScript, even if there’s global path stuff, please let me know or add a PR. Always great to be robust to more scenarios. :smiley: Thanks!

The package tsc is in the dev dependencies of app_package. Removing it should fix it.

1 Like

Done. Didn’t realize that was deprecated. Good catch, thanks!

1 Like

I removed this line but with no success.
After changing tsc --watch -p to tsc *.ts --watch I got some green files at least :slight_smile:
Still there are some errors (console screenshot below) which I couldn’t overcome.

Thats probably a symlink issue from using a file uri to install app_package or npm-recursive-install or both, plus webpack has bad caching logic so its not looking for the file because it didnt find it before it was compiled and its looking for file change events. You may need to do a second install after you compile the typescript in app_package in order for the test_package to see it. Or, maybe just running tsc before webpack instead of concurrently. It depends if the first install did a symlink or hard link. Is your intent to test the package template or just trying to get something going?

1 Like

Made the fresh clone from the latest commit and now it works! :slight_smile: Thank you!
(sphere texture is already at at Asset Host Template

Seems that I finally found a good way to establish more organized workflow, especially regarding the fact that here designers have their own assets repo and are separated from the code repository.

By the way, there is a tutorial mentioned in the Docs - hope it will be published soon.



Fruit Fallin’ Demo on Twitter