When I open a JavaScript file, the file appears as plain text. When I activate javascript-mode in more (SPC SPC) on a .js file, then the file is correctly formatted.

I have the layer installed with the following configuration under dotspacemacs-configuration-layers:

(javascript :variables
            javascript-backend 'tern
            javascript-fmt-tool 'prettier
            javascript-import-tool 'import-js
            node-add-modules-path t
            js2-include-node-externs t
            js2-strict-missing-semi-warning nil
            javascript-repl `nodejs)

I have been verifying my installation + configuration here. I don't see anything out of the ordinary. Here is my .spacemacs file for reference.

  • Do you have an entry for Javascript files in your auto-mode-alist? Probably somethings line ` ("\\.js[mx]?\\'" . javascript-mode)`.
    – NickD
    Apr 8, 2020 at 17:20
  • If you are not in javascript-mode then in which mode are you in?
    – DJJ
    Apr 9, 2020 at 21:09
  • How do I check what mode I am in? Shouldn't it automatically detect it? My knowledge of spacemacs is limited, sorry. Apr 11, 2020 at 0:59
  • @NickD I have (add-to-list 'auto-mode-alist '("\\.jsx?$" . "\\.js[x]?\\'")) in dotspacemacs/user-config Apr 11, 2020 at 1:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.