Webpack 4 cannot load babylon file


I am using webpack 4 to bundle my project. But after bundling i get this error in console.

I am using .babylon format and I’ve imported both babylon and babylon loaders.

 import * as BABYLON from 'babylonjs';
 import 'babylonjs-loaders';

Also I am using this code to load the model.
BABYLON.SceneLoader.Load(“assets/mesh/”, “scene1.babylon”, engine, function (scene) {});

I am kinda beginner with webpack so I am not sure if I have to include something in webpack.config.file. Maybe babylon-file-loader?

Could you share a github link to your project ?

This looks strange knowing you are not even using the es6 version of Babylon.js.

Hmm. Turns out it’s the same thing on my every other project. It is because of the CORS request. I usually was writing my projects without servers… I know that chrome couldn’t show any of the babylon content without live server. But on Mozilla It worked. Now it seems that Mozilla forbid it too.

1 Like