In index.ts I import a typescript file (import {Dropdown} from "../../../../<folder>/<file>)
This imported ts file has an import of jquery defined: import * as $ from 'jquery'
When building, I get an error that module jquery cannot be found.
I also added this import in index.ts as that is where external libraries are imported.
But I still get the same issue.
As a test, I created a ts file on same level as the index.ts file and copied the content of the imported file.
When I use this new file, all works fine.
However according to the guidelines, I am supposed to use the import (shared code over multiple projects).
I don't find a solution for the jquery error.
Has someone a suggestion?
I used the latest version of the CLI to create PCF project.
Solved! Go to Solution.
The shared DropDown was created by a colleague who has left the team.
To solve the issue I have removed the node_modules in the DropDown folder, and re-installed jquery (and only jquery).
That seems to fix the issue.
(I should have thought about trying this trick earlier).
I'll document it for the person(s) who will have to take over after my leave.
Your best approach is probably to install the jquery typescript declaration file and see if that resolves the issue. So in the directory the project is in run
npm install --save jquery
and
npm install --save-dev @types/jquery
And to reference it in the project do the following.
import $ from "jquery"; // or import $ = require("jquery");
You may also need to include with --allowSyntheticDefaultImports—add "allowSyntheticDefaultImports": true in tsconfig.json but I don't know if that is essential or just something from years ago.
I already tried this: doesn't solve the issue unfortunately.
The shared DropDown was created by a colleague who has left the team.
To solve the issue I have removed the node_modules in the DropDown folder, and re-installed jquery (and only jquery).
That seems to fix the issue.
(I should have thought about trying this trick earlier).
I'll document it for the person(s) who will have to take over after my leave.
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
7 | |
3 | |
2 | |
2 | |
2 |