I am trying to use a third party script in a Stencil component which I copied into the build directory. I intend on using stand alone components on various websites. I am not building a Stencil app.
stencil.config.ts
export const config: Config = {
namespace: 'community-component',
outputTargets: [
{ type: 'dist' },
{ type: 'docs' },
{
type: 'www',
serviceWorker: null // disable service workers
}
],
copy: [
{ src: 'www/assets/myscript.js', dest: 'assets/js/myscript.js' }
]
};
Then I import it like this, which is not correct. myscript.js
also loads jQuery.
import * as MyScript from '../../../src/www/assets/myscript.js';
declare const jQuery: any;
Now I get Uncaught ReferenceError: jQuery is not defined
.