英文:
How to add dependency for @vaadin/vaadin-element-mixin in a gradle project
问题
The code you provided appears to be an error message and code related to building a web component, specifically involving Vaadin components in a JavaScript project. It seems to be missing a dependency and encountering issues with the build process.
The error message indicates that the dependency '@vaadin/vaadin-element-mixin' is missing, and it suggests that this module should be added to 'build.rollupOptions.external.' It also mentions issues with TypeScript and Gradle.
It seems like you are looking for a solution or hint on how to resolve these issues. To address this problem, you may need to:
-
Ensure that you have the necessary dependencies installed. You should have '@vaadin/vaadin-element-mixin' in your project's dependencies.
-
Check your project's configuration files, such as 'package.json' and any configuration files for your build tools. Make sure that the dependencies are correctly listed.
-
If you're using Gradle, make sure you've added the dependency correctly in your Gradle configuration.
-
Verify that the versions of the dependencies are compatible with your project.
-
It's important to ensure that the module paths and imports in your code are accurate and match the project structure.
-
If you're encountering TypeScript issues, check your TypeScript configuration files (e.g., 'tsconfig.json') to make sure the paths and typings are correctly set up.
-
Make sure you have all the required files and resources in the right locations.
The specific solution to your problem may require more detailed analysis of your project's setup and configuration. You may also want to consult the documentation for Vaadin and your build tools to resolve these issues.
英文:
While trying to change and build the web-component SelectionGrid
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
import { ElementMixin } from '@vaadin/vaadin-element-mixin';
import { GridElement } from '@vaadin/vaadin-grid/src/vaadin-grid.js';
import {
_getItemOverriden,
_selectionGridSelectRow,
_selectionGridSelectRowWithItem
} from './helpers';
class VcfSelectionGridElement extends ElementMixin(ThemableMixin(GridElement)) {
constructor() {
....
i get a
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':vaadinBuildFrontend'.
> Vite process exited with non-zero exit code.
Stderr: 'vite v3.2.5 building for production...
transforming...
✓ 112 modules transformed.
[vite]: Rollup failed to resolve import "@vaadin/vaadin-element-mixin" from "frontend/src/vcf-sel-table.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "@vaadin/vaadin-element-mixin" from "frontend/src/vcf-sel-table.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
at onRollupWarning ()
at onwarn ()
at Object.onwarn ()
at ModuleLoader.handleResolveId ()
at
Obviously the dependency @vaadin/vaadin-element-mixin is missing. The dependency for the @vaadin/vaadin-themable-mixin is present in the packages.json; but not the element-mixin. Since packages.json is generated by the vaadinPrepareFrontend task i do not have a clue where i can add that dependency.
I m also wondering where and how that @vaadin in typescript is resolved. I assume all the ts for the web-components is packaged in jar files ...
I tried to add a dependency to the gradle file - of course to no avail
dependencies {
implementation("org.webjars.bowergithub.vaadin:vaadin-element-mixin:2.4.2")
Any hint appreciated what i should investigate ...
答案1
得分: 3
The correct import path is now:
import { ElementMixin } from '@vaadin/component-base/src/element-mixin';
英文:
You are probably using Vaadin 23 and you have copied the code from the components repository's master branch, which is for Vaadin 14.
The correct import path is now:
import { ElementMixin } from '@vaadin/component-base/src/element-mixin';
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论