pradel / create-react-app-esbuild

Use esbuild in your create-react-app for faster compilation, development and tests
MIT License
563 stars 35 forks source link

Latest version throws an unexpected token error #39

Closed madiodio closed 3 years ago

madiodio commented 3 years ago

Hi there.

The latest version (0.4.0) doesn't compile when launching the start command (craco start, I haven't tested the other commands). This is what's getting printed on the console:

UnhandledPromiseRejectionWarning: /Users/<readacted>/repro-cra-craco-esbuild-bug/node_modules/craco-esbuild/src/index.js:65
    const minimizerOptions = pluginOptions?.esbuildMinimizerOptions || {
                                           ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:1053:16)
    at Module._compile (internal/modules/cjs/loader.js:1101:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)

I have put together a simple repro. You can check it out here → https://github.com/madiodio/repro-cra-craco-esbuild-bug