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

HMR crashes on syntax errors #5744

Closed
1 task done
dmarkow opened this issue Mar 9, 2023 · 3 comments
Closed
1 task done

HMR crashes on syntax errors #5744

dmarkow opened this issue Mar 9, 2023 · 3 comments
Assignees

Comments

@dmarkow
Copy link
Contributor

dmarkow commented Mar 9, 2023

What version of Remix are you using?

1.14.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

Save a file with a syntax error, for example unbalanced parentheses or brackets. The new dev server crashes and exits, and you have to restart it manually.

± yarn run-p dev:serve dev:remix
yarn run v1.22.19
$ /Users/dylan/dev/pfcs/node_modules/.bin/run-p dev:serve dev:remix
$ NODE_ENV=development remix dev
$ PORT=3000 NODE_ENV=development node --watch-preserve-output --watch server.js
(node:9139) ExperimentalWarning: Watch mode is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Remix server listening on port 3000 development
/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1591
  let error = new Error(`${text}${summary}`);
              ^

Error: Build failed with 1 error:
browser-route-module:routes/seminars/new/route.tsx?browser:17:17: ERROR: [plugin: remix-hmr] Transform failed with 1 error:
<stdin>:97:11: ERROR: Expected ")" but found "}"
    at failureErrorWithLog (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1591:15)
    at /Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1047:28
    at runOnEndCallbacks (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1463:61)
    at buildResponseToResult (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1045:7)
    at /Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1157:14
    at responseCallbacks.<computed> (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:694:9)
    at handleIncomingPacket (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:749:9)
    at Socket.readFromStdout (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:670:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
  errors: [
    {
      detail: Error: Transform failed with 1 error:
      <stdin>:97:11: ERROR: Expected ")" but found "}"
          at failureErrorWithLog (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1591:15)
          at /Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:828:29
          at responseCallbacks.<computed> (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:694:9)
          at handleIncomingPacket (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:749:9)
          at Socket.readFromStdout (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:670:7)
          at Socket.emit (node:events:513:28)
          at addChunk (node:internal/streams/readable:324:12)
          at readableAddChunk (node:internal/streams/readable:297:9)
          at Readable.push (node:internal/streams/readable:234:10)
          at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
        errors: [
          {
            detail: undefined,
            id: '',
            location: [Object],
            notes: [],
            pluginName: '',
            text: 'Expected ")" but found "}"'
          }
        ],
        warnings: []
      },
      id: '',
      location: {
        column: 17,
        file: 'browser-route-module:routes/seminars/new/route.tsx?browser',
        length: 28,
        line: 17,
        lineText: 'import Form from "~/components/seminars/form";',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: {
            column: 12,
            file: 'node_modules/@remix-run/dev/dist/compiler/plugins/hmrPlugin.js',
            length: 6,
            line: 150,
            lineText: '      build.onLoad({\n' +
              '    at setup (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/dist/compiler/plugins/hmrPlugin.js:150:13)\n' +
              '    at handlePlugins (/Users/dylan/dev/pfcs/node_modules/@remix-run/dev/node_modules/esbuild/lib/main.js:1276:21)',
            namespace: 'file',
            suggestion: ''
          },
          text: 'This error came from the "onLoad" callback registered here:'
        }
      ],
      pluginName: 'remix-hmr',
      text: 'Transform failed with 1 error:\n' +
        '<stdin>:97:11: ERROR: Expected ")" but found "}"'
    }
  ],
  warnings: []
}

Node.js v18.14.2
error Command failed with exit code 1.

Expected Behavior

Bad builds should display the error in the console, and then recover properly to monitor for the next save.

Actual Behavior

Bad builds crash the dev server.

@andrecasal
Copy link

I'm having the same issue.

@raskyer
Copy link

raskyer commented Mar 10, 2023

Probably a duplicate of #5631

@dmarkow
Copy link
Contributor Author

dmarkow commented Mar 10, 2023

Whoops, yes -- not sure how I missed that one.

@dmarkow dmarkow closed this as completed Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants