https://pulumi.com logo
#typescript
Title
# typescript
b

bland-lamp-16797

02/11/2021, 11:00 AM
Ok, I'm spending lot of time on this... I use internal package for reusing cloud components. The problem is that I get weird error when I try to import
Copy code
error: Running program '/Users/confiq/work/xxx/pulumi' failed with an unhandled exception:
    /Users/confiq/work/wave-xxx-service/pulumi/node_modules/xxx-pulumi/index.ts:1
    import * as pulumi from "@pulumi/pulumi";
           ^

    SyntaxError: Unexpected token *
        at Module._compile (internal/modules/cjs/loader.js:723:23)
        at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
        at Object.require.extensions.(anonymous function) [as .ts] (/Users/confiq/work/wave-xxx-service/pulumi/node_modules/ts-node/src/index.ts:431:14)
        at Module.load (internal/modules/cjs/loader.js:653:32)
If I take same file and use it as non-package, it works. This is probably beyond my knowledge of typescript/javascript but did anyone have something similar? Somehow pulumi think this is javascript but it's definitely typescript and I don't want to downgrade 😞
ok... when I run
npm install <folder>
it does work. if i run
npm install @remote_npm/package
does not. It seems the problem is how i deploy it to npmjs.com
ok... silly me... of course I need to compile... Although I thought I could use pure typescript in lib too
g

gifted-terabyte-92288

02/11/2021, 3:00 PM
You can't use pure TS in an npm package, unfortunately. It always has to be compiled down to some version of Ecmascript.
b

bland-lamp-16797

02/12/2021, 8:36 AM
yeah, I've learned it little harder way! Pity, I'm losing lot of functionality this way, example default arguments of functions are not readable anymore 😞 Also debugging is little harder
2 Views