You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
When using typescript with electron-compile, the typescript compiler will resolve to commonjs, requiring commonjs variants of ES6-imported modules. Many times, this is acceptable, but for things like vue-router and sfc's, which have separate es6-style variants declared as "module" in their package.json, it is not, because the structure of the exported object is different depending on the javascript standard you use. There is an option in the tsconfig.json's compiler options ("module": "es2015",) that you can use to counter this, but then it exports as es6 javascript, which cannot be sent directly to node, but needs to be compiled again through babel or a similar precompiler. It is possible to write functional code the way it is, but it doesn't play nice with editors that support typescript, which kind of defeats the purpose. It would be nice if we could have a gulp-like configuration, where we can pipe code through multiple compilers before sending it to node, but that's probably overkill.
TLDR
Typescript currently resolves package names to their commonjs variants when using "module": "commonjs". In order to work properly with editors like vscode and atom, we need to use ES6 syntax, so it must be changed to "module": "es6" which outputs code that is not syntactically correct for node, and must be pre-compiled again with babel before being sent to node.
Any help would be appreciated
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Long version
When using typescript with electron-compile, the typescript compiler will resolve to commonjs, requiring commonjs variants of ES6-imported modules. Many times, this is acceptable, but for things like vue-router and sfc's, which have separate es6-style variants declared as "module" in their package.json, it is not, because the structure of the exported object is different depending on the javascript standard you use. There is an option in the tsconfig.json's compiler options ("module": "es2015",) that you can use to counter this, but then it exports as es6 javascript, which cannot be sent directly to node, but needs to be compiled again through babel or a similar precompiler. It is possible to write functional code the way it is, but it doesn't play nice with editors that support typescript, which kind of defeats the purpose. It would be nice if we could have a gulp-like configuration, where we can pipe code through multiple compilers before sending it to node, but that's probably overkill.
TLDR
Typescript currently resolves package names to their commonjs variants when using
"module": "commonjs"
. In order to work properly with editors like vscode and atom, we need to use ES6 syntax, so it must be changed to"module": "es6"
which outputs code that is not syntactically correct for node, and must be pre-compiled again with babel before being sent to node.Any help would be appreciated
The text was updated successfully, but these errors were encountered: