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

Remix Monorepo 1.68 breaks Cypress in Indie Stack when importing from file #147

Closed
miku86 opened this issue Aug 19, 2022 · 5 comments
Closed

Comments

@miku86
Copy link

miku86 commented Aug 19, 2022

Hi folks,

thanks for Remix and the great community!

I just updated Remix from 1.67 to 1.68 and one cypress tests fails now.


What version of Remix are you using?

1.68

Steps to Reproduce

  1. Create a new indie stack project with npx create-remix --template remix-run/indie-stack
  2. Create a cypress test that uses an import in the form of either import { generateRandomInt } from "../../app/utils/helpers" or import { generateRandomInt } from "~/utils/helpers"
  3. See cypress break with:
Webpack Compilation Error
./node_modules/@remix-run/react/dist/esm/components.js 730:45
Module parse failed: Unexpected token (730:45)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     id
|   } = useRemixRouteContext();
>   let resolvedPath = useResolvedPath(action ?? "."); // Previously we set the default action to ".". The problem with this is that
|   // `useResolvedPath(".")` excludes search params and the hash of the resolved
|   // URL. This is the intended behavior of when "." is specifically provided as
 @ ./node_modules/@remix-run/react/dist/esm/index.js 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232
 @ ./app/utils/helpers.ts
 @ ./cypress/e2e/todos.cy.ts
GET /__cypress/tests?p=cypress/e2e/todos.cy.ts 200 2945.281 ms - -
GET /__cypress/tests?p=cypress/support/e2e.ts 200 3673.227 ms - -
GET /__/assets/FiraCode-VariableFont_wght.16865a4d.ttf 200 1.741 ms - -

Expected Behavior

I want the import to work.

Solution

  • When I downgrade from monorepo version 1.68 to 1.67, it works again.
  • When I replace the import with inline code, it works again.

Actual Behavior

A webpack compilation error:

Webpack Compilation Error
./node_modules/@remix-run/react/dist/esm/components.js 730:45
Module parse failed: Unexpected token (730:45)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     id
|   } = useRemixRouteContext();
>   let resolvedPath = useResolvedPath(action ?? "."); // Previously we set the default action to ".". The problem with this is that
|   // `useResolvedPath(".")` excludes search params and the hash of the resolved
|   // URL. This is the intended behavior of when "." is specifically provided as
 @ ./node_modules/@remix-run/react/dist/esm/index.js 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232 13:0-232
 @ ./app/utils/helpers.ts
 @ ./cypress/e2e/todos.cy.ts
GET /__cypress/tests?p=cypress/e2e/todos.cy.ts 200 2945.281 ms - -
GET /__cypress/tests?p=cypress/support/e2e.ts 200 3673.227 ms - -
GET /__/assets/FiraCode-VariableFont_wght.16865a4d.ttf 200 1.741 ms - -
@miku86 miku86 changed the title Remix Monorepo 1.68 breaks Cypress in Indie Stack Remix Monorepo 1.68 breaks Cypress in Indie Stack when importing from file Aug 19, 2022
@MichaelDeBoey MichaelDeBoey transferred this issue from remix-run/remix Aug 20, 2022
@MichaelDeBoey
Copy link
Member

I think this is fixed by #160 & #161

@miku86
Copy link
Author

miku86 commented Sep 26, 2022

Hey @MichaelDeBoey,

unfortunately no.

I was able to track it down to the change from @remix-run/react 1.6.7 to 1.6.8.

What I tried so far:

  • updating to remix monorepo 1.7.2: breaks
  • downgrading to remix monorepo 1.6.7: works
  • upgrading to remix monorepo 1.7.2 and only downgrading @remix-run/react to 1.6.7: works
  • moving helper.ts into the same folder as my test: breaks
  • copying the imported code into the test: works

So it seems to me that it definitely has something to do with the import of the code, after @remix-run/react: 1.6.7.

I always deleted node_modules, build, public/build and package-lock.json.

@machour machour reopened this Sep 26, 2022
@aaronfulkerson
Copy link

I'm actually having this exact same issue in a non-Remix React/Vite project where we moved our frontend repo into a subfolder of our backend repo.

@github-actions
Copy link

This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed.

@github-actions
Copy link

This issue has been automatically closed because we didn't hear anything from the original author after the previous notice.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 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