Skip to content

Refer to ESM modules, not CJS ones #277

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

Merged
merged 5 commits into from
Jun 10, 2022
Merged

Refer to ESM modules, not CJS ones #277

merged 5 commits into from
Jun 10, 2022

Conversation

JordanMartinez
Copy link
Contributor

@JordanMartinez JordanMartinez commented Jun 8, 2022

Description of the change

Fixes #276.

#276 is caused by two issues:

  • Update to 0.15.0; use ES Module Shims #275 changed the URL ultimately used to resolve the imports from https://compile.purescript.org/output to https://try.purescript.org/output. This approach meant we didn't need to remap the paths used in import statements as we could just use the base element. However, that means we send a request to the wrong domain.
  • Originally, the modules served via https://compile.purescript.org/output/*/.js would return the files found in /var/www/trypurescript/staging/.psci_modules/node_modules/$1. This is no longer the place where such files are outputted in an ESM world (I'm not sure why). Rather, they're outputted in /var/www/trypurescript/staging/.psci_modules/$1.

To summarize:

We need to fix the URL remapping approach to use the correct URL
-https://try.purescript.org/output
+https://compile.purescript.org/output

We need to update the alias for serving `output/Module.Path/*.js` to use this alias
-/var/www/trypurescript/staging/.psci_modules/.psci_modules/$1
+/var/www/trypurescript/staging/.psci_modules/$1

Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0 by @)")
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

@JordanMartinez
Copy link
Contributor Author

I'll have to complete this another day.

@JordanMartinez JordanMartinez marked this pull request as ready for review June 10, 2022 00:08
Copy link
Contributor

@MonoidMusician MonoidMusician left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Two minor things:

  1. I think client/setBase.mjs can be removed now?
  2. Don't forget to update the README to not mention base now ;)

@JordanMartinez JordanMartinez merged commit 69ee71a into purescript:master Jun 10, 2022
@JordanMartinez JordanMartinez deleted the fix-compile-path branch June 10, 2022 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Try PureScript is broken
3 participants