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

Quokka not using ts compilerOptions in .quokka file #710

Closed
msabramo opened this issue Nov 8, 2021 · 5 comments
Closed

Quokka not using ts compilerOptions in .quokka file #710

msabramo opened this issue Nov 8, 2021 · 5 comments
Labels

Comments

@msabramo
Copy link

msabramo commented Nov 8, 2021

Issue description or question

Quokka appears to not be using ts compilerOptions configuration in the .quokka file, as described at https://quokkajs.com/docs/configuration.html#compiler-settings

In particular, paths was what appears to be not be working. If I put paths in a tsconfig.json file, then it works, but attempting to delete the tsconfig.json and putting the configuration under ts/compilerOptions in the .quokka file, it appears to not work.

Is this issue related to Quokka not outputting the expected results of your code?: No

Sample repository link

https://github.com/msabramo/quokka-paths-example

Note this repo is forked from https://github.com/lemonmade/quokka-paths-example -- that original repo works fine because it has the paths configuration in tsconfig.json. My fork is the same except it attempts to move the configuration to the .quokka file, but it doesn't work.

Quokka.js Console Output

​​​​​Quokka PRO 'quokka.ts' (node: v16.12.0, TypeScript: v4.4.4)​​​​

​Install "my-package" package for the current quokka file​
​Install "my-package" package into the project​
 
Cannot find module 'my-package' 
Require stack: 
- ./quokka.js 
  ​​​​​at ​​​​​​​​Object.<anonymous>​​​ ​quokka.ts:1​
  ​​​​​at ​​​​​​​​Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename]​​​ ​/Users/abramowi/.quokka/node_modules/@cspotcode/source-map-support/source-map-support.js:679​

Code editor version

Visual Studio Code v1.61.2

OS name and version

OSX

@msabramo
Copy link
Author

msabramo commented Nov 8, 2021

The ability to put the Quokka TypeScript config in package.json doesn't seem to be working either. Example package.json:

{
  "name": "quokka-paths-example",
  "version": "1.0.0",
  "quokka": {
    "ts": {
      "compilerOptions": {
        "baseUrl": ".",
        "rootDir": ".",
        "moduleResolution": "node",
        "paths": {
          "*": [
            "*",
            "packages/*",
            "app/*"
          ]
        }
      }
    }
  },
  "main": "app.ts",
  "author": "Chris Sauve <chrismsauve@gmail.com>",
  "license": "MIT"
}

@msabramo
Copy link
Author

msabramo commented Nov 8, 2021

I also attempted to use inline config and that didn't work either. Example quokka.ts:

({
    "ts": {
        "compilerOptions": {
            "baseUrl": ".",
            "rootDir": ".",
            "moduleResolution": "node",
            "paths": {
                "*": [
                    "*",
                    "packages/*",
                    "app/*"
                ]
            }
        }
    }
})

import myPackage from 'my-package';
import app from 'app';

console.log('myPackage :>> ', myPackage);
console.log('app :>> ', app);

@msabramo
Copy link
Author

msabramo commented Nov 8, 2021

I suspect that the problem is that the paths are handled by tsconfig-paths rather than Quokka itself. But if that is the case, maybe the fact that paths don't work should be documented.

@smcenlly
Copy link
Member

smcenlly commented Nov 8, 2021

Thanks for reporting your problem. Quokka was indeed not handling the case where paths were set/overridden in the your Quokka configuration. This has been fixed in Quokka for VS Code v1.0.414. Please update to this version and it will work for you.

@smcenlly smcenlly closed this as completed Nov 8, 2021
@smcenlly smcenlly added the bug label Nov 8, 2021
@msabramo
Copy link
Author

msabramo commented Nov 8, 2021

Amazing! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants