Closed robertrossmann closed 7 years ago
I haven't tested Babel V7 yet. Looks like they changed the property name in the API that returns the error. I'll take a look.
Looks like a bug in Babel itself. babelTransformSync doesn't seem to work correctly and crashes out without returning an error object.
Hmm, looks like now the method is throwing an error instead of returning the error - what about wrapping the call in try/catch
block...? That should help.
I have tracked it down and sent a PR to Babel guys/gals: https://github.com/babel/babel/pull/6503
I think you can safely close this as it only occurs with the latest betas. Or you can keep it open to track the progres. Up to you. 😄
Thanks for looking into it!
Good to see your PR to fix this issue. Thanks.
any updates ? still getting the error
npm babel -v 6.0.1
@iliutastoica This issue was for Babel V7 and was reported to the Babel repo and should be fixed in the latest beta. The version you are given using npm is V6 and is fine. However npm will probably list the global installed babel and that won't likely be the version used in a real babel project. Normally, babel would exist in the node-modules folder of a babel project, or if a multi-repo such as Lerna was used at a higher level. This allows multiple version of babel to exist.
I would need more information if you believe this is a bug. Your project folder structure, .languagebabel
, .babelrc
, babel version in projects node-modules, etc. Please open another issue.
[Enter steps to reproduce:]
Atom: 1.45.0 x64 Electron: 4.2.7 OS: Unknown Windows version Thrown From: language-babel package 2.85.0
Uncaught TypeError: Cannot read property 'code' of undefined
At C:\Users\tangj15\.atom\packages\language-babel\lib\transpiler.coffee:215
TypeError: Cannot read property 'code' of undefined
at /packages/language-babel/lib/transpiler.coffee:215:65
at ~/AppData/Local/atom/app-1.45.0/resources/app/static/<embedded>:14:43875
at ~/AppData/Local/atom/app-1.45.0/resources/app/static/<embedded>:14:43716
at Function.simpleDispatch (~/AppData/Local/atom/app-1.45.0/resources/app/static/<embedded>:11:1214120)
at Emitter.emit (~/AppData/Local/atom/app-1.45.0/resources/app/static/<embedded>:11:1215561)
at ChildProcess.<anonymous> (~/AppData/Local/atom/app-1.45.0/resources/app/static/<embedded>:14:42817)
at ChildProcess.emit (events.js:182:13)
at emit (internal/child_process.js:812:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
-7:09.1.0 window:run-package-specs (input.hidden-input)
-6:49 window:toggle-dev-tools (input.hidden-input)
-6:41.6.0 sync-settings:backup (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-atom-dark-ui)
6x -6:22.8.0 core:save (input.hidden-input)
-3:30.4.0 github:discard-changes-in-selected-files (span.github-FilePatchListView-path)
-3:00.3.0 fuzzy-finder:toggle-file-finder (input.hidden-input)
19x -2:52 core:backspace (input.hidden-input)
-2:35.8.0 command-palette:toggle (input.hidden-input)
14x -2:28.3.0 core:backspace (input.hidden-input)
-2:18.7.0 settings-view:check-for-package-updates (input.hidden-input)
-1:46.6.0 core:save (input.hidden-input)
atom-beautify 0.33.4
atom-ide-ui 0.13.0
atom-ide-vue 1.3.1
atom-live-server-plus 3.0.1
atom-math 0.0.9
atom-select-npm-install 1.0.2
atom-ternjs 0.20.0
atom-typescript 13.5.0
autocomplete-modules 2.3.0
autocomplete-paths 2.12.2
console-log 1.10.0
debug 0.0.1
docblockr 0.13.7
emmet 2.4.3
file-icons 2.1.40
git-control 0.9.0
git-log 0.4.1
git-plus 8.7.1
hey-pane 1.2.0
highlight-selected 0.17.0
Hydrogen 2.14.1
hyperclick 0.0.0
ide-css 0.3.4
ide-html 0.6.0
ide-json 0.2.1
ide-typescript 0.9.1
ide-vue 0.1.9
ide-yaml 0.7.0
js-refactor 0.8.1
js-refactor-atom 0.10.1
language-babel 2.85.0
language-diff 0.7.0
language-postcss 1.3.1
linter 2.3.1
minimap 4.29.9
minimap-highlight-selected 4.6.1
npm-outdated 0.6.0
npm-plus 0.4.0
open-in-atom-pkg 1.0.1
pigments 0.40.2
prettier-atom 0.58.2
pretty-json 2.1.2
quick-log 0.3.1
regex-railroad-diagram 0.19.4
script 3.25.0
scroll-sync 0.2.4
scroll-through-time 0.3.1
set-syntax 0.4.0
sort-lines 0.19.0
sync-settings 4.3.2
tab-foldername-index 3.3.1
toggle-quotes 1.1.4
tree-view-copy-relative-path 1.2.0
tree-view-git-status 1.5.3
vue-fmt 0.1.1
vue-template-beautify 0.1.2
Description
When I save a file with syntax errors and I have transpilation on save enabled, language-babel will throw an uncaught error.
Expected behaviour
I think the correct behaviour would be to not throw any errors, or, at most, show a standard warning about syntax errors being present in the file. For the best developer experience, these warnings would not be shown in cases where ie. Linter is already active. If this is too difficult, then perhaps an option to supress such warnings could be added (
Supress Transpile On Save Messages
could be used to silence such warnings).Steps to reproduce
language-babel
, enableTranspile On Save
andCreate Transpiled Code
Atom: 1.22.0-beta1 x64 Electron: 1.6.15 OS: Mac OS X 10.13 Thrown From: language-babel package 2.75.2
Stack Trace
Uncaught TypeError: Cannot read property 'code' of undefined
Commands
Non-Core Packages