So I enabled tree shaking on ParcelJS, and I got this error when opening the .html :
Access to XMLHttpRequest at ‘file:///C:/Users/XXXX/Documents/MyProjects/XXXX/parcel_test/dist/src/Shaders/default.vertex.fx’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I dont know why the script looks for “src/Shaders/default.vertex.fx” in the /dist folder.
I’m wondering if I need to import some module ?
without treeshaking, the build works fine.
Current modules imported:
import { Engine } from “@babylonjs/core/Engines/engine”;
import { Scene } from “@babylonjs/core/scene”;
import { Vector3, Color3 } from “@babylonjs/core/Maths/math”;
import { HemisphericLight } from “@babylonjs/core/Lights/hemisphericLight”;
import { StandardMaterial } from “@babylonjs/core/Materials/standardMaterial”;
import { Texture } from “@babylonjs/core/Materials/Textures/texture”;
import { SceneLoader } from “@babylonjs/core/Loading/sceneLoader”;
import “@babylonjs/loaders/glTF/2.0/glTFLoader”;
import “@babylonjs/core/Loading/loadingScreen”;
import “@babylonjs/core/Loading/Plugins/babylonFileLoader”;
import “@babylonjs/core/Cameras/universalCamera”;