vuepress-plugin-example-preview
vuepress-plugin-example-preview copied to clipboard
chore: temporarily make it work
Oh, such a great plugin! π
But I'm going to talk about a sad story.
This is a temporary workaround for that VuePress doesn't work when we import CommonJS module at client side:
const loadLanguages = require('prismjs/components/index') // A CommonJS module
This is a known weird issue, and I spent a lot of time on webpack and babel's repo to do research but couldn't find the answer, which caused us cannot share the same CommonJS format code on the server side and the client, so that VuePress had such a internal plugin for now π:
https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/internal-plugins/transformModule.js
I suspect that there is a problem with the babel configuration built into vuepress, but I haven't had time to continue the investigation. If you have any ideas, please let me know, thank you.
Codecov Report
Merging #1 into master will decrease coverage by
10.07%
. The diff coverage is63.15%
.
@@ Coverage Diff @@
## master #1 +/- ##
===========================================
- Coverage 95.55% 85.48% -10.08%
===========================================
Files 10 10
Lines 45 62 +17
Branches 6 14 +8
===========================================
+ Hits 43 53 +10
- Misses 2 9 +7
Impacted Files | Coverage Ξ | |
---|---|---|
lib/highlight.js | 63.63% <63.15%> (-16.37%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Ξ = absolute <relative> (impact)
,ΓΈ = not affected
,? = missing data
Powered by Codecov. Last update bfb5944...f1ea720. Read the comment docs.