Skip to content

Fail to resolve JSX #2058

Closed
adamlaska/osmos-cosmos-sdk
#5
@EmiyaYang

Description

@EmiyaYang
  • 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>;
|   }
| };

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions