"You may need an additional loader to handle the r...
# i-need-help
h
https://stackoverflow.com/questions/76317770/cypress-typescript-you-may-need-an-additional-loader-to-handle-the-result-o (boosting my own question) I'm using Vue (although i don't think it's actually relevant), Cypress, and TypeScript. one of my files, foo.ts happens to access import.meta.url:
Copy code
// src/foo.ts
export const FOO = import.meta.url;
In my real code it uses import.meta.url to contrive the path to a file in the 'public' directory. Hard-coding "/path/to/whatever.json" works in prod but doesn't work in cypress component tests which is why i have to use import.meta.url. foo.ts works fine when imported by the web app and from component tests; problem is only when i also try to access it from cypress e2e test code.
Copy code
// cypress/e2e/example.cy.ts
import { FOO } from "../../src/foo"; // (also, how do i get the '@' prefix to work?)
describe('My First Test', () => {
  it('visits the app root url', () => {
    cy.visit('/')
    cy.contains('h1', 'You did it!')
  })
})