question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compilation issues when using different root directory

See original GitHub issue

Description

When using typescript and specifying a different root directory via vite.config.js , compilation issues arise .

Reproduction

1 - In the provided zip, start the server, which behaves as expected. I’m running the command yarn run dev

2 - Move the index.html inside another directory, changing the root directory inside vite.config.js accordingly -> At this point, the server starts up and displays only plain html, which is to be expected, since it couldn’t find the script.

3 - Update the ‘src’ property inside the index to correctly point to the main.ts module. At this point, i’m getting a unexpected token exception. Its interesting to note that the server does starts, and the error occurs only when accessing the url.

Additional Information

Initially, i thought it had something to do with the tsconfig.json properties or path, but after changing compilerOptions, and moving the file around ( specifying its path with the tsconfigFile property inside svelte.config.js , i could not reproduce the issue.

The vite-plugin ( not included in the zip ) was installed following the directives in this repo readme.md.

error envinfo.txt canelhasio.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
dominikgcommented, May 2, 2021

closing here as the original issue can be solved with relative configFile option added in 1.0.0-next.8: svelte({configFile:"../svelte.config.js"})

1reaction
dominikgcommented, May 1, 2021

no, svelte.config.ts is not supported right now. It could be added but that would have to be a concerted effort as there are other tools also reading svelte config. You could setup your own transpile step to use it without framework support

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compilation failing because ROOT is searching for files in the ...
The problem is at the compilation time. For some reason, some include files and libraries are searched in the source / compilation directory...
Read more >
compilation-mode: default-directory != src-root
At first I give a recipe for reproduction of your problem (hopefully I understood it right). Afterwards I will present a solution.
Read more >
Compiling C programs under different directories using ...
It seems that you will have to place a separate makefile in each sub-directory and recursively call each once starting from the root...
Read more >
TSConfig Option: rootDir - TypeScript
Importantly, rootDir does not affect which files become part of the compilation. It has no interaction with the include , exclude , or...
Read more >
Configuring project structure | WebStorm Documentation
In WebStorm, content is a collection of files with which you are currently ... The top-level folder of a project is its content...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found