Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token '<' (at VM201 Build.loader.js:1:1) #489

Open
1 of 2 tasks
inar-vision opened this issue Feb 16, 2023 · 13 comments
Open
1 of 2 tasks

Unexpected token '<' (at VM201 Build.loader.js:1:1) #489

inar-vision opened this issue Feb 16, 2023 · 13 comments
Assignees
Labels

Comments

@inar-vision
Copy link

Please avoid duplicates

Language and Compiler

Babel and WebPack JavaScript

What environment are you using?

Local Development Server

When does your problem occur?

When the Context is created

What does your problem relate to?

The problem seems React related

React-Unity-WebGL Version

9.4.0

React Version

18.2.0

Unity Version

2021.3.4f1

What happened?

  • First I've created a "create-react-app"
  • Npm install react-unity-webgl
  • Set the Unity Config object as I think it should be set
  • npm start

I get an Error about unexpected token..? Seems to be that a lot of people have got this, but I can't seem to figure this out.
vscode_appjs
The_error

Reproducible test case

No response

Would you be interested in contributing a fix?

  • yes, I would like to contribute a fix
@jeffreylanters
Copy link
Owner

Remove ../public from your URLs, that should fix it.

@inar-vision
Copy link
Author

Not entirely, I'm getting a couple new error on Build.framework.js
framework

@jeffreylanters
Copy link
Owner

You've removed too much, Keep the leading / 😁

@inar-vision
Copy link
Author

That's not it. :( Trust me, I've tried pretty much every combination on those paths..
v2_framework

@levkovich2806
Copy link
Contributor

levkovich2806 commented Feb 21, 2023

Have the same error.
create-react-app with react-unity-webgl

image

image

@levkovich2806
Copy link
Contributor

In appearance, there are some problems when working specifically with CRA, because the installation in react project, which was created by "hands" (https:/dev.to/stepstep.to/ivadyhabimana/how--create-a-withwithout-appervice-creang----reactrea-appBusi-a30nl) - everything works

@willy20040711
Copy link

The link seem don't work any more.

In appearance, there are some problems when working specifically with CRA, because the installation in react project, which was created by "hands" (https:/dev.to/stepstep.to/ivadyhabimana/how--create-a-withwithout-appervice-creang----reactrea-appBusi-a30nl) - everything works

@MiguelZamoraRey
Copy link

i have the same error with CRA and react-unity-webgl.

@levkovich2806 can you reupload the link with created by ¨hands¨ solution plz?

@levkovich2806
Copy link
Contributor

Create react app without CRA - https://dev.to/ivadyhabimana/how-to-create-a-react-app-without-using-create-react-app-a-step-by-step-guide-30nl

@MiguelZamoraRey
Copy link

Thanks @levkovich2806!

I have tried to use the library with Vite instead of CRA and it works perfectly.

@boxqkrtm
Copy link

boxqkrtm commented May 26, 2023

you can fix with CRA

add webpack.config.js in project root

example webpack.config.js

const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');

module.exports = {
    entry: './index.js',
    mode: 'development',
    output: {
        path: path.resolve(__dirname, './dist'),
        filename: 'index_bundle.js',
        publicPath: '/'
    },
    target: 'web',
    devServer: {
        port: '5000',
        static: {
            directory: path.join(__dirname, 'public')
        },
        open: true,
        hot: true,
        liveReload: true,
    },
    resolve: {
        extensions: ['.js', '.jsx', '.json'],
    },
    module: {
        rules: [
            {
                test: /\.(js|jsx)$/,
                exclude: /node_modules/,
                use: 'babel-loader',
            },
        ],
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: path.join(__dirname, 'public', 'index.html')
        })
    ]
};

@YukimuraKyoko
Copy link

YukimuraKyoko commented Aug 3, 2023

image
I have the same exact problem, with the URLs correct and everything, however my project wasn't created from create-react-app, but rather I pulled a react template and started modifying it. What should I do in this case? The template is CoreUI incase you're wondering.

Edit: I realized there's a "WebGL" extra text in the dataurl, however even after fixing that. The problem remains the same.

@amirali-bim
Copy link

facing same problem. have you figured out the solution ? @YukimuraKyoko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants