Skip to content

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

@K4T

Description

@K4T

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',
        },
    },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions