Closed sunyeongchoi closed 1 year ago
I changed from babel to esbuild-loader.
However, after changing to esbuild-loader, optional chaining does not work properly.
The document states that the optional chaining function is available when using ES2020.
My webpack configuration is as follows, but it doesn't work properly.
{ enforce: 'pre', test: /\.js$/, exclude: [/node_modules/, /build/], loader: 'esbuild-loader', }, { test: /\.tsx?$/, loader: 'esbuild-loader', options: { loader: 'tsx', target: 'es2020', }, },
The following error occurs:
ERROR in ./src/features/resources/catalog/UserCatalogCreatePage.tsx 9:63 Module parse failed: Unexpected token (9:63) File was processed with these loaders: * ./node_modules/esbuild-loader/dist/index.js You may need an additional loader to handle the result of these loaders. | const UserCatalogCreatePage = ({ match }) => { | const breadcrumbs = useGetCreateBreadCrumbs(void 0); > const createItem = useMemo(() => getCreateItemByString(match?.params?.createitem), [match]); | return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Helmet, { title: createItem?.name || "" }), /* @__PURE__ */ React.createElement("div", { className: "container" }, /* @__PURE__ */ React.createElement("div", { className: "top_title" }, /* @__PURE__ */ React.createElement(Breadcrumbs, { breadcrumbs })), /* @__PURE__ */ React.createElement(CreateContentFactory, { match }))); | };
Optional chaining should work properly.
no
v2.18.0
v16.20.2
yarn
Linux
Can you provide a reproduction? Happy to re-open once provided.
Problem
I changed from babel to esbuild-loader.
However, after changing to esbuild-loader, optional chaining does not work properly.
The document states that the optional chaining function is available when using ES2020.
My webpack configuration is as follows, but it doesn't work properly.
The following error occurs:
Expected behavior
Optional chaining should work properly.
Minimal reproduction URL
no
Version
v2.18.0
Node.js version
v16.20.2
Package manager
yarn
Operating system
Linux
Contributions