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

NcButton styles missing in bundler output in 8.12 #5719

Closed
hschletz opened this issue Jun 19, 2024 · 2 comments
Closed

NcButton styles missing in bundler output in 8.12 #5719

hschletz opened this issue Jun 19, 2024 · 2 comments

Comments

@hschletz
Copy link

After updating from 8.11.3 to 8.12, NcButton components in my app lack styling when built via "vite build" or "vite watch":

8 12

The CSS rules for the ".button-vue" selectors are missing. Output from "vite dev" is correct, and the rules exist:

8 11 13

Downgrading to 8.11.3 temporarily fixes the problem.

Here's the vite.config.ts I used for the screenshot:

import { createAppConfig } from '@nextcloud/vite-config'
import { defineConfig } from 'vite'
import tsconfigPaths from 'vite-tsconfig-paths'

const config = defineConfig(async () => ({
    plugins: [
        tsconfigPaths(),
    ],
    resolve: {
        // Adding extensions here has no effect
        extensions: ['.js', '.ts', '.vue', '.scss'],
    },
}))

export default createAppConfig({
    // Entry points...
}, {
    config,
})
@hschletz
Copy link
Author

I sort of found the problem, which is apparently not caused by @nextcloud/vue directly. The observed behavior is just a symptom.

My application has multiple entry points. One of them is the main application from which the screenshots were taken. Another one is a plugin for the files application which shares some dependencies with the main application. Vite splits common code into separate files which will be loaded automatically. This usually works fine.

One of those shared dependencies is @nextcloud/dialogs which both entry points use for toasts. After removing all references to this package from the files plugin, the main application displays correctly. In fact, the problem can be reproduced by any additional entry point as simple as

import { showError } from "@nextcloud/dialogs"
showError('boo')

Using both packages in a single entry point does not cause problems.

I suspect the root cause is with @nextcloud/dialogs, which acts weirdly regarding bundling, tree shaking and code splitting.

I'm leaving this issue open in case you plan to make the package immune to interference (up to 8.11.3, this was not a problem).

@ShGKme
Copy link
Contributor

ShGKme commented Jun 21, 2024

Hi @hschletz

This is probably a Vite's bug. We have just created a Vite plugin in our @nextcloud/vite-config to fix this behavior.

nextcloud-libraries/nextcloud-vite-config#204

It is to be released very soon.

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

No branches or pull requests

2 participants