Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Error vendor.js when using ChartField
Error vendor.js when using ChartField [message #1834125] Tue, 03 November 2020 11:45 Go to next message
Christoph Quinten is currently offline Christoph QuintenFriend
Messages: 13
Registered: November 2020
Junior Member
Hi,
I've tried to include the ChartField from the Widget app into my own scout application.
Now when I start the application there is an error message saying "404_NOT_FOUND: GET /vendors.js - MDC[]"

I've searched in this forum and found the following discussion:
https://www.eclipse.org/forums/index.php/m/1823783/#msg_1823783

Here it says:
"You need to add a dependency to the package.json in the ui.html module. Then call npm install (or pnpm if you use that). Make sure chart.js exists in your node_modules folder. Does your index.html loads the "vendors.js"? Webpack puts the external libraries in this chunk when the build runs. If your index.html does not request it, the library is never loaded and the module loader in your application will wait forever for that library to be loaded"

I've done everything of the named steps, but the steps to fix it doesn't help me. Could you please give me some help to start the app and use the ChartField?
Re: Error vendor.js when using ChartField [message #1834141 is a reply to message #1834125] Tue, 03 November 2020 16:57 Go to previous messageGo to next message
Mr Robot is currently offline Mr RobotFriend
Messages: 72
Registered: March 2020
Member
Put: Chart.bundle.js, chart.css in ui.html/src/main/js.

You also need to create ChartField.js in same folder. And in ChartField.js

add this to import Chartjs.bundle.js

import {Chart} from './Chart.bundle.js';


to have content like this:

import {FormField} from '@eclipse-scout/core';
import $ from 'jquery';

import {Chart} from './Chart.bundle.js';

export default class ChartField extends FormField {


Chart.css will be imported trough Chart.bundle.js file

In index.js add this:
// import your custom JS files here
export {default as ChartField} from './ChartField';
export {default as ChartFieldAdapter} from './ChartFieldAdapter';


http://prntscr.com/vcqdnu

[Updated on: Tue, 03 November 2020 16:59]

Report message to a moderator

Re: Error vendor.js when using ChartField [message #1834151 is a reply to message #1834141] Tue, 03 November 2020 22:08 Go to previous message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 259
Registered: March 2010
Senior Member
Hi,

even though it will work, I would rather import the chart.js library directly from the node_modules folder instead of copying it to the source folder and import it from there.

import {Chart} from 'chart.js';

See the example here:
https://github.com/BSI-Business-Systems-Integration-AG/org.eclipse.scout.docs/blob/releases/10.0/code/widgets/org.eclipse.scout.widgets.ui.html/src/main/js/custom/chartfield/ChartField.js

Maybe the vendors.js cannot be found because it was not generated due to a missing import of chart.js. Have a look at the dist folder. If there is no vendors.js, the browser won't be able to load it.
Previous Topic:Autocompletion and syntax for JS
Next Topic:Zyklisches Update HTML Tile
Goto Forum:
  


Current Time: Tue Nov 12 13:10:08 GMT 2024

Powered by FUDForum. Page generated in 0.07733 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top