react-email-editor icon indicating copy to clipboard operation
react-email-editor copied to clipboard

Can't build with Vite

Open OddBlueDog opened this issue 4 years ago • 2 comments

When I do npm run build I get an error. I'm using Vite currently instead of CRA.

The render function looks fine instead index.js of react-email-editor, so I'm unsure why I'm getting this error.

image

OddBlueDog avatar Dec 31 '21 10:12 OddBlueDog

✓ 267 modules transformed.
[commonjs] Unexpected token (24:6) in C:/Users/Tom/Documents/Projects/Helpappy/frontend/node_modules/react-email-editor/src/index.js
file: C:/Users/Tom/Documents/Projects/Helpappy/frontend/node_modules/react-email-editor/src/index.js:24:6
22:
23:     return (
24:       <div
          ^
25:         style={{
26:           flex: 1,
error during build:
SyntaxError: Unexpected token (24:6) in C:/Users/Tom/Documents/Projects/Helpappy/frontend/node_modules/react-email-editor/src/index.js
    at Parser.pp$5.raise (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:19547:13)
    at Parser.pp.unexpected (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:16872:8)
    at Parser.pp$4.parseExprAtom (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:18922:10)
    at Parser.pp$4.parseExprSubscripts (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:18714:19)
    at Parser.pp$4.parseMaybeUnary (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:18680:17)
    at Parser.pp$4.parseExprOps (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:18613:19)
    at Parser.pp$4.parseMaybeConditional (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:18596:19)
    at Parser.pp$4.parseMaybeAssign (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:18564:19)
    at Parser.pp$4.parseParenAndDistinguishExpression (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:19018:28)
    at Parser.pp$4.parseExprAtom (C:\Users\Tom\Documents\Projects\Helpappy\frontend\node_modules\rollup\dist\shared\rollup.js:18881:41)```

OddBlueDog avatar Jan 26 '22 12:01 OddBlueDog

Recently ran into this issue myself (my setup is CRA though). This means your bundler doesn't understand JSX syntax. My workaround was exposing the lib directory instead of downloading the relevant babel plugins.

ayushmanchhabra avatar Jan 26 '22 14:01 ayushmanchhabra