mihatorikei / codeigniter-vitejs

ViteJS Integration For Codeigniter4 🔥⚡
MIT License
89 stars 10 forks source link

There is a bug problem. #25

Open smartyoon opened 1 year ago

smartyoon commented 1 year ago

CodeIgniter version: 4.2.10 Package version: vue 3.2.27

Describe the bug A clear and concise description of what the bug is.

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.

Hey, guys!

Please understand even if I am not good at English. You did a great job making it. Congratulations!! And I did it exactly as it was in the manual, but there was a bug.

codeigniter-vite-vue@0.0.0 dev

vite

VITE v3.2.4 ready in 455 ms

➜ Local: http://localhost:3479/ ➜ Network: use --host to expose

When I logged on, only 404 not found page came out.

Here's the current sauce.

package.json

{
    "name": "codeigniter-vite-vue",
    "private": true,
    "version": "0.0.0",
    "scripts": {
        "dev": "vite",
        "build": "vite build",
        "preview": "vite preview"
    },
    "dependencies": {
        "vue": "^3.2.37"
    },
    "devDependencies": {
        "@vitejs/plugin-vue": "^3.0.0",
        "vite": "^3.0.0"
    }
}

composer.json

{
    "name": "codeigniter4/appstarter",
    "type": "project",
    "description": "CodeIgniter4 starter app",
    "homepage": "https://codeigniter.com",
    "license": "MIT",
    "require": {
        "php": "^7.4 || ^8.0",
        "codeigniter4/framework": "^4.0",
        "mihatori/codeignitervite": "^1.1"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9",
        "mikey179/vfsstream": "^1.6",
        "phpunit/phpunit": "^9.1"
    },
    "suggest": {
        "ext-fileinfo": "Improves mime type detection for files"
    },
    "autoload": {
        "exclude-from-classmap": [
            "**/Database/Migrations/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\Support\\": "tests/_support"
        }
    },
    "scripts": {
        "test": "phpunit"
    },
    "support": {
        "forum": "http://forum.codeigniter.com/",
        "source": "https://github.com/codeigniter4/CodeIgniter4",
        "slack": "https://codeigniterchat.slack.com"
    }
}

I don't know what the problem is, but I want you to leave a detailed manual. I love the work you made by you. But I don't think there will be a problem if the bug problem is solved. That's a compliment. Haha! 👍😉

jaguarch commented 1 year ago

You've probably tried to access your project from vite server (http://localhost:3479/) you need to access it from your web server package (wampserver, xampp) or simply run php spark serve and then open http://localhost:8080 in your browser

check this, may help https://github.com/firtadokei/codeigniter-vitejs/issues/11#issuecomment-1190642719

to make it more clear, npm run dev has only one purpose and it's to serve your assets such as javascripts and stylesheets files during development, once you run npm run build, there is no need to run it again.

smartyoon commented 1 year ago

I even thought of a live server. If you don't have it, I'll make it myself. And is the ssr function supported? Is this a feature that doesn't exist? For your information, I wrote the answer using a translator. Please be considerate. thanks.