Skip to content

[backend-integration] Include CSS and other assets in manifest #6595

@lubomirblazekcz

Description

@lubomirblazekcz

Clear and concise description of the problem

Currently the only possible option to input files for build is .js files in blob.

rollupOptions: {
    input: FastGlob.sync(['./src/**/*.js']).map(entry => resolve(process.cwd(), entry))
}

If I add .css files into the blob, it doesn't have a expected entry in manifest.json. Which doesn't seem to be something that should be hard to fix, css files are processed correctly, only manifest entry is missing.

This is also the main reason why to use other alternatives and use Vite only as dev server and build assets with different tools, such us esbuild and gulp-esbuild etc.

Suggested solution

css files should be included in manifest.json as entry, if added in rollupOptions.input, it's also an issue here - #6477

This should be then included in the manifest

  "src/styles/main.css": {
    "file": "assets/main.9bc805c4.css",
    "src": "src/styles/main.css"
  },
  "src/assets/logo.png": {
    "file": "assets/logo.b2fe66e5.png",
    "src": "src/assets/logo.png"
  },

Alternative

The current only way to get .css file into manifest and load it as stylesheet (sources and also procecced files) is to use this dirty hack

if (typeof window[9999] !== 'undefined') {
  (async() => await import('/src/styles/main.css'))()
}

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions