JavaScript annotation doesn't work with context:// URLs in npm mode
See original GitHub issueI have the @JavaScript("context://js/test.js")
attached to my route, in hopes to load JavaScript files as plain JS (not as a module) from src/main/webapp/js/test.js
.
However, Vaadin tries to look up the javascript file from the node_modules
and fails.
Minimal reproducible example
- The Skeleton Starter project: Add
@JavaScript("context://js/test.js")
annotation to theMainView
class. - Run the Skeleton Starter.
Expected behavior
The produced HTML page should load a script from src/main/webapp/js/test.js
.
Actual behavior
The webpack compilation fails with
Failed to find the following imports in the `node_modules` tree:
- context://js/test.js
If the build fails, check that npm packages are installed.
Versions:
- Vaadin / Flow version: 4.1.27 / 2.1.9
- Java version: 8
- OS version:
- Browser version (if applicable):
- Application Server (if applicable):
- IDE (if applicable): Intellij
Issue Analytics
- State:
- Created 3 years ago
- Comments:26 (23 by maintainers)
Top Results From Across the Web
Could not find a declaration file for module 'module-name ...
So i created Declarator, a npm package that generate type declarations automatically. It basically works by running tsc --emitDeclarationOnly in the background.
Read more >Working with JavaScript in Visual Studio Code
This can happen in a few instances: You are working with JavaScript or TypeScript code on vscode. dev or github. dev and VS...
Read more >Common errors | npm Docs
The error Error: ENOENT, stat 'C:\Users\<user>\AppData\Roaming\npm' on Windows 7 is a consequence of joyent/node#8141, and is an issue with the Node ...
Read more >Annotation Type JavaScript - Vaadin
Defines JavaScript dependencies on a Component class. ... In NPM mode this URL identifies a file which will be bundled, so the file...
Read more >Run/Debug Configuration: NPM | IntelliJ IDEA Documentation
Node.js - The plugin is available only in IntelliJ IDEA Ultimate, where it is enabled by default. Create: Run | Edit Configurations ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AB-xdev I’m very sorry, you’re right. I think the commits were pushed to our cherry-pick branch for 2.3, but someone accidentally deleted it and created new one for picking changes into without this change. This is our mistake, we’ll do a new 2.3.7 release ASAP and push the changes there. Sorry for the mess.
@AB-xdev Hi thanks for the heads up - we simply missed picking this. I’ve pushed it to the cherry-pick branch and it should then be in 2.3.5 and another 14.3 release in two weeks or so.