stocky-island-3676
01/08/2020, 4:04 PMimport * as gcp from '@pulumi/gcp'
^^^^^^
SyntaxError: Cannot use import statement outside a module
from a dependency
saved in Github repo. What am I missing?broad-helmet-79436
01/08/2020, 4:09 PMimport
isn’t valid in node unless the file is an .mjs
file and you’re in node 13 or newerstocky-island-3676
01/08/2020, 4:12 PM.gitignore
d, i.e. not in the Github repo. That could explain why it works locally.
You know what the best-practice is?broad-helmet-79436
01/08/2020, 4:15 PM"main"
field to point to the transpiled codebuild/index.js
or somethingstocky-island-3676
01/08/2020, 4:23 PMpackage.json
, or?
"scripts": {
"build": "tsc"
},
(taken from https://github.com/pulumi/pulumi-gcp/blob/master/sdk/nodejs/package.json#L12-L14)
The other way would be to push also the transpiled JS file to the Github repo."scripts": {
"build": "tsc",
"prepare": "npm run build"
},
doesn’t work, either.
(The prepare
part is from https://www.reddit.com/r/typescript/comments/9ctsbd/how_do_i_publish_a_typescript_library_to_a/e5db0e4/)broad-helmet-79436
01/08/2020, 6:38 PMstocky-island-3676
01/09/2020, 12:49 PMgit+https://
.
Seems like pushing the transpiled JavaScript code is the way to go, as you mentioned. Others take the same approach:
https://stackoverflow.com/questions/55002806/how-to-publish-a-private-typescript-npm-package-in-git/55004794#55004794