Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

ESNext support #915

Closed
ReeRichard opened this issue Oct 17, 2019 · 6 comments
Closed

ESNext support #915

ReeRichard opened this issue Oct 17, 2019 · 6 comments
Labels
HARP-7602 wontfix This will not be worked on

Comments

@ReeRichard
Copy link

Hi,

I would like to use harp.gl in my embedded web project. Unfortunately, the project is running on typescript transpiled to esnext as target.
This means I cannot use harp.gl at the moment.

I tried to port it but it seems to be a lot more work than expected.
Are there any plans to support it in the future or can you suggest an alternative?

I really love what you have done with this library and being able to use harp.gl would be awesome.

@nzjony
Copy link
Member

nzjony commented Oct 21, 2019

@ReeRichard , thanks for creating this issue, I see that @CraigBerlin has created an internal issue on our side. We will prioritize and hopefully we can get someone to look into it soon!

@zbigg
Copy link
Contributor

zbigg commented Oct 21, 2019

@ReeRichard Could you please tell what exactly doesn't work for you?
In particular, how do you bundle, what is your tsconfig.json ?
(Repo with minimal repro would be awesome).

I am not aware of any fundamental problems that make our packages incompatible with TS esnext target.

@ReeRichard
Copy link
Author

Hi, thank you for your support.

I probably confuse some things here since I'm pretty new to Typescript/Module Resolution Ecosystem. The problem is more about how java script is loaded/included. I use Lit-element as the main system for rendering components. And every module is loaded through import * as XY from Z instead of the require(filename) that is found anywhere in the harp.gl code and transpiled version. The require method is not supposed to work anymore as it looks like with the latest target such as esnext?

This is how my tsconfig.json looks like

{
	"compileOnSave": true,
	"compilerOptions": {
		"baseUrl": "../",
		"declaration": true,
		"rootDir": "./",
		"outDir": "../build",
		"target": "esnext",
		"module": "esnext",
		"moduleResolution": "node",
		"alwaysStrict": true,
		"allowJs": false,
		"strictBindCallApply": true,
		"strictFunctionTypes": true,
		"strictPropertyInitialization": true,
		"strictNullChecks": true,
		"experimentalDecorators": true,
		"emitDecoratorMetadata": true,
		"noFallthroughCasesInSwitch": true,
		"noImplicitAny": true,
		"noImplicitReturns": true,
		"noUnusedLocals": true,
		"noImplicitThis": true,
		"noUnusedParameters": false,
		"removeComments": false,
		"skipLibCheck": true,
		"preserveConstEnums": true,
		"sourceMap": true,
		"pretty": true,
		"lib": [
			"esnext",
			"dom"
		]
	},
	"include": [
		"../src/**/*.ts"
	],
	"exclude": [
		"node_modules"
	]
}

@zbigg
Copy link
Contributor

zbigg commented Oct 21, 2019

require(filename) that is found anywhere in the harp.gl code

Yeah, just as I've expected. Yes, we have few require leftovers caused by problems with build environment, hopefully we can fix them soon.
Until now, the only workaround is to bundle our code with webpack which support mixed require & import in sources or use harp.js in already bundled form - https://github.com/heremaps/harp.gl/tree/master/%40here/harp.gl, but this has some disadvantages like lack of typings.

require method not supposed to work anymore as it looks like with the latest target such as esnext?

It never worked directly, it was just bundler responsibility to handle this function in special way. I assume that you don't use any bundler, that's why you encounter problems. It's just our fault that some of use assumed that everyone uses bundler and that it's webpack :)

@ReeRichard
Copy link
Author

Ok understood. I see that something like webpack makes sense, I thought I will loose ability to properly debug this thing when using webpack but I will give it a try.

For now what works is that I built harp.gl with target for esnext import it as usual but then remove the import as a post build step and replace it by referencing the bundled version. This way I can use the typed version during development and the bundled during run-time.
A little bit hacky but good for now. So this has no high priority as it works quite well.

Thank you again for this neat library.

@stale
Copy link

stale bot commented Dec 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 20, 2019
@stale stale bot closed this as completed Jan 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
HARP-7602 wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants