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

On Windows environments path to assets are broken as they contain incorrect slash #13

Open
K4T opened this issue Jun 29, 2023 · 0 comments

Comments

@K4T
Copy link

K4T commented Jun 29, 2023

Hello, first at all - thank you for your time you used to develop this plugin. Unfortunately today I spotted one problem when I was trying to use it "production" mode.

Generally on Windows environments DS is equal to "\" which should not be used in URLs which are produced by e.g. getLinkFromOutDirectory method.

Like mentioned above, DS is used in e.g. getLinkFromOutDirectory method from ManifestRecord class:

return $outDirectory . DS . $assetLink;

to build path to assets like js or css files. This, on Windows, creates following, incorrect URLs like http://test.localhost/js/%5Cassets/main-5de7cc61.js which of course does not load.

Here is my cakephp-vite plugin configuration:

'ViteHelper' => [
    'development' => [
        'scriptEntries' => ['webroot_src/main.js'],
    ],
]

Here is vite.confg.js I am using:

import {defineConfig} from 'vite'

export default defineConfig({
    build: {
        emptyOutDir: false,
        outDir: './webroot',
        manifest: true,
        rollupOptions: {
            input: './webroot_src/main.js',
        },
    },
    server: {
        port: 3000,
        strictPort: true,
        hmr: {
            protocol: 'ws',
            host: 'localhost',
        },
    },
});
@passchn passchn self-assigned this Sep 20, 2023
@passchn passchn removed their assignment Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants