0

I tried to use and extension for angular called Painterro. It's working perfectly with local build but after deployment I got an error that:

TypeError: no.Painterro is not a function:

enter image description here

Im wondering what is that first part "no." ? And why this is not working after deployment but its working perfectly fine locally.

To import, I use in my component:

import * as Painterro from '../../../node_modules/painterro/build/painterro.min.js'

my package.json:

enter image description here

I also tried to like download the painterro and import it from the project assets but I get the same result (after publish of course).

What was tried:

  • Using lower version of painterro (1.2.10)
  • Try to: Import Painterro from 'painterro' - but that gives me an error 404.

I spend like whole day searching for fix, but I couldn't find it.

If I need to provide any more information, please ask.

Is it like error of the extension or is it general error and im making mistake somewhere?

After using ` import Painterro from 'paintero' Im getting:

enter image description here

and visual studio (where i tried to install it on highest typescript/angular version) is telling me that :

enter image description here

Forey
  • 81
  • 7
  • Hi! Please take the [tour], have a look around, and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) RE *"my package.json"* (and others): Please post code, error messages, markup, and other textual information **as text**, not as a *picture* of text. Why: http://meta.stackoverflow.com/q/285551/157247 – T.J. Crowder Aug 30 '21 at 15:55
  • *"Im wondering what is that first part "no." ?"* It sounds like you're using a bundler, and it's converting native module syntax to CommonJS or similar, and `no` is the name of the variable it's used for the module object (like the `n` and `Yi` and `t` you can see in the stack track). – T.J. Crowder Aug 30 '21 at 15:57
  • Your trying to import a `.js` library into a `.ts` project. Can you try to search for `compilerOptions` and to add `"allowJs": true,` into it ? If needed I can add a more detailed answer. such topics may also help you: https://stackoverflow.com/questions/37081943/angular-2-import-external-js-file-into-component – Raphaël Balet Aug 30 '21 at 16:03
  • I tried to add allowJS to compiler but that didn't help. I found that im possible to use like: "Import Painterro from 'painterro'" on clean angular project but somehow, doing the same in other project is causing 403 forbidden. Do anyone knows why forbidden is showing in project? Is there somekind of visual studio (not visual studio code) settings which can cause that? – Forey Aug 31 '21 at 13:17

0 Answers0