I want to re-use some functionallity that we have built using three.js and that we are successfully using on our second project which is built on PHP.
Now I want to import the same thing to Angular 2 project that is using webpack.
Currently I'm struggling with one issue. In the JS file we have piece of code:
loader.load( base_url + 'tmp/' + 'model.js', function( object ){
console.log("File loaded successfully");
}
that was copied from our second website. That code needs to load file from base url, tmp folder and file is called model.js
I put that file in angular 2 project at root where I created tmp/ folder and I added model.js into that folder.
But, console.log("File loaded successfully");
was never executed.
I tried to use Chrome console to debug what is wrong.
When I put breakpoint on loader.load and type in a console full path to the file
loader.load("http://localhost:4200/tmp/model.js", function(object) {
console.log("test");
});
I'm getting message "undefined".
Of course I was not able to get my file trough web browser typing in url
http://localhost:4200/tmp/model.js
because everything was pre-packed and moved into main.bundle.js file.
Is there any workaround ? Any suggestion and advice will be helpful.