Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

katex=0.8.1 cannot be loaded with error "unexpected token import" #16

Closed
shunliz opened this issue Aug 13, 2017 · 6 comments
Closed

katex=0.8.1 cannot be loaded with error "unexpected token import" #16

shunliz opened this issue Aug 13, 2017 · 6 comments

Comments

@shunliz
Copy link

shunliz commented Aug 13, 2017

with katex=0.8.1, plugin load will fail, complain as below

debug: readme found at README.md
debug: summary file found at SUMMARY.md
debug: cleanup folder "C:\Users\zsli\AppData\Local\Temp\tmp-10564ld8oP2BXSmdZ"
info: 10 plugins are installed
info: 8 explicitly listed
info: loading plugin "katex"... ERROR

PluginError: Error with plugin "katex": Unexpected token import

@cimi
Copy link

cimi commented Aug 14, 2017

I have the same problem, it worked until very recently.

info: install plugin "katex" (*) from NPM with version 1.1.3
[project path]
├── gitbook-plugin-anchor-navigation-ex@1.0.10
├─┬ gitbook-plugin-callouts@0.1.1
│ └─┬ cheerio@0.19.0
│   └─┬ htmlparser2@3.8.3
│     └── domutils@1.5.1
├─┬ gitbook-plugin-katex@1.1.3
│ └─┬ katex@0.8.1
│   └── match-at@0.1.0
├── gitbook-plugin-mermaid-gb3@2.0.0
├── gitbook-plugin-prism@2.2.1
├─┬ gitbook-plugin-todo@0.1.3
│ └─┬ cheerio@0.19.0
│   └─┬ htmlparser2@3.8.3
│     └── domutils@1.5.1
└── gitbook-plugin-toggle-chapters@0.0.3

Starting up the server fails because katex can't load. If I remove katex from the list of plugins everything works fine.

$ gitbook serve
Live reload server started on port: 35729
Press CTRL+C to quit ...

info: 14 plugins are installed
info: 11 explicitly listed
info: loading plugin "prism"... OK
info: loading plugin "callouts"... OK
info: loading plugin "mermaid-gb3"... OK
info: loading plugin "anchor-navigation-ex"... OK
info: loading plugin "toggle-chapters"... OK
info: loading plugin "katex"... ERROR

PluginError: Error with plugin "katex": Unexpected token import

I am using the latest version of everything:

$ gitbook --version
CLI version: 2.3.2
GitBook version: 3.2.2

$ node --version
v8.2.1 (also tried with v6.9.1)

$ npm --version
5.3.0

The main katex package the plugin depends on was updated two days ago. I see that the plugin's package.json is configured so that updates are automatically picked up:

    "dependencies": {
        "katex": ">=0.5.1"
    }

This should be locked down to the latest known stable version.

@cimi
Copy link

cimi commented Aug 14, 2017

@SamyPesse PR #18 fixes this, I've been using it locally through npm link.

It would be great to get this merged in soon as this issue breaks all builds that use katex.

@AaronO AaronO closed this as completed in 518fd32 Aug 16, 2017
@cimi
Copy link

cimi commented Aug 16, 2017

👍 Thanks!

I was literally looking up the documentation for npm publish as I wanted to fix the build failures by publishing my changes under a different name.

@AaronO I see that you did not merge my commit that included the package version bump. Please publish a new version of the package on npm so we can actually use it.

@AaronO
Copy link
Contributor

AaronO commented Aug 16, 2017

@cimi Publishing a new release in ~10mn.

I started reviewing your PR, but it included a lot of unnecessary (some bad) changes (like changing the README, repo URL, version), the only change required was locking katex to 0.7.1. So rather than leave a review with a bunch of comments I just went ahead and committed the core change :)

It's usually a considered a bad practice to bump as part of a pull request (because it's trivial for the maintainer to bump a new version once it's on the master).

In general pull requests should be focused on solving a single well defined problem and avoid modifying extra files (makes it longer to review and harder to merge). So as a general measure, the smaller the PR the better :)

(Just some friendly advice for next time, I appreciate you taking the time to actually submit a PR :D)

@AaronO
Copy link
Contributor

AaronO commented Aug 16, 2017

@cimi Voilà, a 1.1.4 release is out with your fix !

@cimi
Copy link

cimi commented Aug 16, 2017

I started reviewing your PR, but it included a lot of unnecessary (some bad) changes (like changing the README, repo URL, version), the only change required was locking katex to 0.7.1. So rather than leave a review with a bunch of comments I just went ahead and committed the core change :)

Those changes should not have been part of the PR - I didn't realise github automatically includes all future commits on the originating branch in the pull request. The changes in the second commit (README, name, repo etc.) were done because I was going to publish gitbook-plugin-katex-es5 so that I can unblock my build. The original PR (first commit) only had the katex version change and the version bump.

Thank you for resolving! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants