question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JavaScript annotation doesn't work with context:// URLs in npm mode

See original GitHub issue

I 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

  1. The Skeleton Starter project: Add @JavaScript("context://js/test.js") annotation to the MainView class.
  2. 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:closed
  • Created 3 years ago
  • Comments:26 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
plekucommented, Sep 29, 2020

@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.

1reaction
plekucommented, Aug 18, 2020

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found