highlightjs / highlightjs-vue

highlight.js syntax definition for Vue.js
BSD 3-Clause "New" or "Revised" License
15 stars 6 forks source link

(0 , _highlightjsVue.default) is not a function #9

Open patarapolw opened 4 years ago

patarapolw commented 4 years ago

I think last lines should probably be changed to something like,

var hljsRegisterVue = function(hljs) {
  hljs.registerLanguage("vue", hljsDefineVue);
};

module.exports = hljsRegisterVue;
module.exports.hljsRegisterVue = hljsRegisterVue;
module.exports.hljsDefineVue = hljsDefineVue;

/**
 * @deprecated
 */
module.exports.definer = hljsDefineVue;
LissetteIbnz commented 4 years ago

Can you provide a more info, a codepen for instance? I think this is related to Babel, but I need more info.

patarapolw commented 4 years ago

NVM, I move the definition inside Class scope, so there is no problem now.

patarapolw commented 4 years ago

Still, I believe you shouldn't module.export.definer.

patarapolw commented 4 years ago

The problem returns, but it is easily fixed by changing "main": "vue.js",; So I guess it is a regression report. Rollup doesn't work. (why would you need rollup for commonjs, anyway?)

The code is https://github.com/patarapolw/make-html/blob/59151beb90c583df58227ccbd0f894fab595a4f9/packages/frontend-functions/src/index.ts#L15, BTW.

RobbieTheWagner commented 3 years ago

Seeing this issue too

joshgoebel commented 3 years ago

Highlight.js maintainer here. Please see https://github.com/highlightjs/highlight.js/issues/3008

In core team's opinion the correct answer here is:

And Highlight.js can even build that CDN distributable for you. It takes only a few seconds. Please have a look at the issue in question and let me know if you have any questions.