christian-bromann / docusaurus-theme-github-codeblock

A Docusaurus plugin that supports referencing code examples from public GitHub repositories.
MIT License
23 stars 5 forks source link

[ERROR] Client bundle compiled with errors therefore further build is impossible. #136

Closed mariuszkrzaczkowski closed 5 months ago

mariuszkrzaczkowski commented 8 months ago
× Client
  Compiled with some errors in 27.33s

● Server █████████████████████████ building (65%) 1/1 entries 4371/4371 dependencies 1696/1696 modules 0 active

[ERROR] Client bundle compiled with errors therefore further build is impossible.
Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:13)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
> "use strict";import _wrapRegExp from"d:/www/YetiForceDoc/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js";var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){if(k2===undefined)k2=k;var desc=Object.getOwnPropertyDescriptor(m,k);if(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable)){desc={enumerable:true,get:function get(){return m[k];}};}Object.defineProperty(o,k2,desc);}:function(o,m,k,k2){if(k2===undefined)k2=k;o[k2]=m[k];});var __setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:true,value:v});}:function(o,v){o["default"]=v;});var __importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(k!=="default"&&Object.prototype.hasOwnProperty.call(mod,k))__createBinding(result,mod,k);__setModuleDefault(result,mod);return result;};var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{"default":mod};};Object.defineProperty(exports,"__esModule",{value:true});var react_1=__importStar(require("react"));var CodeBlock_1=__importDefault(require("@theme-init/CodeBlock"));var client_1=require("docusaurus-theme-github-codeblock/client");var RunmeLink_js_1=require("./RunmeLink.js");var utils_js_1=require("./utils.js");var constants_js_1=require("./constants.js");var buttonBarStyles={fontSize:'.9em',fontWeight:600,color:'#0E75DD',textAlign:'right',paddingBottom:'13px',textDecoration:'underline'};function ReferenceCode(props){var _props$metastring,_titleMatch$groups,_titleMatch$groups2;var _ref=(0,react_1.useReducer)(utils_js_1.codeReducer,constants_js_1.initialFetchResultState),fetchResultState=_ref[0],fetchResultStateDispatcher=_ref[1];var codeSnippetDetails=(0,utils_js_1.parseReference)(props.children);if(fetchResultState.loading!==false){(0,utils_js_1.fetchCode)(codeSnippetDetails,fetchResultStateDispatcher);}var titleMatch=(_props$metastring=props.metastring)==null?void 0:_props$metastring.match(/*#__PURE__*/_wrapRegExp(/title="([^"]*)"/,{title:1}));var customProps=Object.assign({},props,{metastring:titleMatch!=null&&(_titleMatch$groups=titleMatch.groups)!=null&&_titleMatch$groups.title?props.metastring+" title=\""+(titleMatch==null||(_titleMatch$groups2=titleMatch.groups)==null?void 0:_titleMatch$groups2.title)+"\"":props.metastring+" title=\""+codeSnippetDetails.title+"\"",children:constants_js_1.initialFetchResultState.code});var codeblockConfig=(0,client_1.useCodeblockThemeConfig)();var showButtons=codeblockConfig.showGithubLink||codeblockConfig.showRunmeLink;return react_1["default"].createElement("div",{className:'docusaurus-theme-github-codeblock'},react_1["default"].createElement(CodeBlock_1["default"],Object.assign({},customProps),fetchResultState.code),showButtons&&react_1["default"].createElement("div",{style:buttonBarStyles},react_1["default"].createElement(RunmeLink_js_1.RunmeLink,{reference:props.children,metastring:props.metastring}),codeblockConfig.showGithubLink&&react_1["default"].createElement("a",{href:props.children,className:'githubLink',style:constants_js_1.buttonStyles,target:"_blank"},codeblockConfig.githubLinkLabel)));}exports["default"]=ReferenceCode;
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

image

{
    "scripts": {
        "docusaurus": "docusaurus",
        "start": "docusaurus start",
        "build": "docusaurus build",
        "swizzle": "docusaurus swizzle",
        "deploy": "docusaurus deploy",
        "clear": "docusaurus clear",
        "serve": "docusaurus serve",
        "write-translations": "docusaurus write-translations",
        "write-heading-ids": "docusaurus write-heading-ids",
        "crowdin": "crowdin"
    },
    "dependencies": {
        "@crowdin/cli": "3",
        "@docusaurus/core": "^3.1.0",
        "@docusaurus/plugin-client-redirects": "^3.1.0",
        "@docusaurus/plugin-pwa": "^3.1.0",
        "@docusaurus/preset-classic": "^3.1.0",
        "@easyops-cn/docusaurus-search-local": "*",
        "@mdx-js/react": "^3.0.0",
        "docusaurus-theme-github-codeblock": "^2",
        "clsx": "^2.0.0",
        "docusaurus-plugin-image-zoom": "^1",
        "docusaurus-plugin-matomo": "^0",
        "prism-react-renderer": "^2.1.0",
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "react-player": "^2",
        "redocusaurus": "^2",
        "url": "^0"
    }
}
christian-bromann commented 8 months ago

Not sure how this is connected to the bundle but every help on resolving the bug is much appreciated!

monica-m-ps commented 8 months ago

Hello. I don't know if this is the right place, but I recently upgraded to Docusaurus 3.x.x and used this package to render GitHub references and it works for me. My docusaurus.config.js looks like:

image

You can see it in action in https://docs.dojo.tech/payments/accept-payments/checkout-page/step-by-step-guide

christian-bromann commented 8 months ago

Thanks for confirming @monica-m-ps , I am using it also very successfully in the webdriver.io project.

@mariuszkrzaczkowski can you maybe provide a minimal reproducible example?

mariuszkrzaczkowski commented 8 months ago

I checked again and still the same, see my repository https://github.com/YetiForceCompany/YetiForceDoc/tree/codeblock image

mariuszkrzaczkowski commented 5 months ago

in the latest version 3.2.1 the error no longer occurs