I have an npm project with the following structure:
app-dep├── dist│├── bundle.js│└── bundle.js.map├── node_modules/├── package.json├── package-lock.json├── src│├── base-component.ts│├── factory.ts│├── app.ts│└── modules/├── tsconfig.json└── webpack.config.js
My app.ts code has an App class that utilizes all .ts files inside src/
export default class App extends HTMLElement { //some-content }
I use webpack to build a bundle.js inside the dist/
folder.
I have another angular project where I install this app-dep
project using
npm install --save ../app-dep
When I try to use it in my angular component:
import App from 'app-renderer/dist/bundle';ngOnInit() { window.customElements.define('micro-app', App);}
I get this error:
Failed to execute 'define' on 'CustomElementRegistry': parameter 2 is not of type 'Function'When I try to log it on console, all I can see is undefined.
It seems that I can't import basic functions even.
Can you tell me what's wrong?