-
Notifications
You must be signed in to change notification settings - Fork 27k
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
test(next): add tests for Node-like hashbang support #27906
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
91ca589
to
70c33b1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Even removing the |
When Webpack support for hashbangs is merged, this PR will become redundant and can be closed: |
Thanks for this PR! Closing in favor of #27929 as you mentioned |
Actually, lets reopen this and turn it into just tests |
Good idea @styfle - did you see my notes about the .mjs extension conflicting with React Refresh? I force-pushed up with commented versions of the tests. I was only able to work around by adding a |
9ffa6be
to
8b9c70e
Compare
* update to webpack 5.50.0 * feat: use shebang loader shim for now * chore: snapshot formatting change * chore: remove unneeded SSR test * chore: test all file extensions * chore: remove shebang loader from Webpack config * chore: revert unnecessary changes * Update test/integration/hashbang/test/index.test.js Co-authored-by: Steven <steven@ceriously.com> * chore: revert changes to yarn.lock Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com> Co-authored-by: Steven <steven@ceriously.com>
The CLI would break for projects that import from an entry-point with a shebang, though they would be valid Node programs.
This PR adds a Webpack loader which removes first-line shebangs from imports to prevent this error.This approach is safe because emitted bundles will never need a shebang, and even if they did, the line could just be prepended, and you would only ever want one—thus, stripping shebangs from each resolved module is the way to go.Hashbang logic was added directly to Webpack by @sokra and has been merged into canary. This PR now adds tests for Node-like support of first-line, Unix-style hashbangs, which should prevent regression from the fix for #27806.