Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to resolve JSX #2058

Closed
1 task done
EmiyaYang opened this issue Dec 2, 2019 · 4 comments · Fixed by #2059 · May be fixed by adamlaska/osmos-cosmos-sdk#5
Closed
1 task done

Fail to resolve JSX #2058

EmiyaYang opened this issue Dec 2, 2019 · 4 comments · Fixed by #2059 · May be fixed by adamlaska/osmos-cosmos-sdk#5
Labels
type: bug Something isn't working

Comments

@EmiyaYang
Copy link

EmiyaYang commented Dec 2, 2019

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

// ./docs/.vuepress/config.js
module.exports = {
  ...
  chainWebpack: (config, isServer) => {
    config.module
      .rule("js") // Find the rule.
      .use("babel-loader") // Find the loader
      .tap(options =>
        merge(options, {
          presets: [
            ["@babel/preset-env"],
            ["@vue/babel-preset-jsx", { injectH: false }]
          ],
          plugins: [
            [
              "import",
              {
                libraryName: "ant-design-vue",
                libraryDirectory: "es",
                style: "css"
              }
            ],
            "@babel/plugin-proposal-optional-chaining"
          ]
        })
      );
  }
}

What is expected?

Recongnize the jsx and run successfully.

What is actually happening?

The running code couldn't recongnize the JSX.

client?cae4:159 ./src/components/ProTree.jsx 87:11
Module parse failed: Unexpected token (87:11)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|   },
|   render(h) {
>     return <span></span>;
|   }
| };
@EmiyaYang EmiyaYang reopened this Dec 2, 2019
@EmiyaYang EmiyaYang changed the title Fail to set alias path Fail to resolve JSX Dec 2, 2019
@meteorlxy meteorlxy added the type: bug Something isn't working label Dec 4, 2019
meteorlxy added a commit to meteorlxy/vuepress that referenced this issue Dec 4, 2019
@EmiyaYang
Copy link
Author

怎么过了这么久都没合上去

@meteorlxy
Copy link
Member

JSX is not a default feature of vuepress. The JSX support from babel will be disabled if evergreen is set to false. So I'm not sure if this feature will be added to core.

@vxhly
Copy link

vxhly commented Jul 23, 2021

如何配置编译 node_modules 下的jsx代码

@justforuse
Copy link

@vxhly 大佬后来搞定了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
4 participants