Jump to content

How to use babylon to build a skybox with webpack? All texture image are 404.


fateriddle
 Share

Recommended Posts

const path = require('path')

module.exports = {
  mode: 'development',

  entry: './src/index.js',

  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
  },

  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
        },
      },
    ],
  },
}

I'm using webpack with a basic setup. Now I'm trying to build a skybox

    skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture(
      './textures/skybox/box',
      scene
    )

Then I get the 404 error for all the files it needed:

box_px.jpg:1 GET http://localhost:1234/textures/skybox/box_px.jpg 404 (Not Found)

box_py.jpg:1 GET http://localhost:1234/textures/skybox/box_py.jpg 404 (Not Found)

box_pz.jpg:1 GET http://localhost:1234/textures/skybox/box_pz.jpg 404 (Not Found)

box_nx.jpg:1 GET http://localhost:1234/textures/skybox/box_nx.jpg 404 (Not Found)

box_ny.jpg:1 GET http://localhost:1234/textures/skybox/box_ny.jpg 404 (Not Found)

box_nz.jpg:1 GET http://localhost:1234/textures/skybox/box_nz.jpg 404 (Not Found)

How to solve this?

Link to comment
Share on other sites

Are you trying to bundle the jpg in your bundle ? I would try to avoid it to prevent download a single large js + preventing nice compression. Now it means you would need to deploy them aside of your lib and if they are could you ensure the path is your expected one ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...