vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
589 stars 164 forks source link

Need Autoprefixer -- seems that Vite is ignoring the vite.config.js #19654

Closed enver-haase closed 2 days ago

enver-haase commented 4 days ago

Description of the bug

Customer is trying to use an Autoprefixer according to

import autoprefixer from 'autoprefixer'
const customConfig: UserConfigFn = (env) => ({
css: {
postcss: {
plugins: [
autoprefixer({}) // add options if needed
],
}
}
});

in the vite.config.js

Both https://github.com/postcss/autoprefixer and https://github.com/postcss/postcss-load-config did not work. It seems that vite.config.js is ignored entirely(?) by Vaadin?

See also, for example, https://github.com/vaadin/flow/issues/19069 and https://github.com/vaadin/flow/issues/14773 which are also complaining about Vite configuration items being ignored.

Minimal reproducible example

Try above code snippet for the vite configuration.

Expected behavior

Actual behavior

Versions:

- Vaadin / Flow version: 24.4.4
- Java version: n/a
- OS version: n/a
- Browser version (if applicable): n/a
- Application Server (if applicable): n/a
- IDE (if applicable): n/a
- Development or production mode: n/a
- Project from start.vaadin.com or activated in application:
mcollovati commented 4 days ago

vite.config.ts is not ignored. The linked issues are related to problems with custom port and protocol for Vite server, that are handled at runtime by Flow ViteHandler class when starting Vite.

Is the application perhaps using the default bundle? You can try to set forceProductionBuild to true in the POM file and check if the custom Vite configuration is applied.

EDIT: I am assuming the issue happens during production build

subITCSS commented 2 days ago

So we tried it out and it works. So the issue can be closed.

enver-haase commented 2 days ago

Thanks. That was the info we needed.