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.

Using tsconfig.json baseUrl and paths

See original GitHub issue

Hi,

I tried to have it work with this package: https://github.com/dividab/tsconfig-paths-webpack-plugin

and this snippet added to preact.config.js:

    config.resolve.plugins = [
      ...(config.resolve.plugins || []),
      new TsconfigPathsPlugin({ logInfoToStdOut: true })
    ]

But I get

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
    at validateString (internal/validators.js:112:11)
    at Object.join (path.js:1040:7)
    at tryPrefix (/Users/antoine/Workspaces/enseignerleclimat/frontend-next/node_modules/less/dist/less.cjs.js:211:53)
    at tryPathIndex (/Users/antoine/Workspaces/enseignerleclimat/frontend-next/node_modules/less/dist/less.cjs.js:270:23)
    at tryPrefix (/Users/antoine/Workspaces/enseignerleclimat/frontend-next/node_modules/less/dist/less.cjs.js:268:29)
    at ReadFileContext.<anonymous> (/Users/antoine/Workspaces/enseignerleclimat/frontend-next/node_modules/less/dist/less.cjs.js:260:48)
    at ReadFileContext.callback (/Users/antoine/Workspaces/enseignerleclimat/frontend-next/node_modules/graceful-fs/graceful-fs.js:123:16)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:250:13)
error Command failed with exit code 1.

when executing yarn dev

I was wondering if this couldn’t be added by default in the config template ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rschristiancommented, May 30, 2020

Glad you solved it.

If you still were interested in adding the plugin to this template, you can make a PR with that change. That way you can run it by the actual maintainers of these templates, and get their thoughts.

1reaction
toniopelocommented, May 30, 2020

I just find out the issue. A @import had a non-existing path in one of my less imports. The error is kind of confusing…

I introduced this error at the same time I added the tsconfig-paths-webpack-plugin. Closing this as non related to this repo.

Thanks for your time, have a nice day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use paths in tsconfig.json? - Stack Overflow
In your tsconfig, place this param and path to the base file ``` { ... "extends": "./tsconfig.base.json", ... } ``` Then in the...
Read more >
TSConfig Reference - Docs on every TSConfig option
A series of entries which re-map imports to lookup locations relative to the baseUrl . There is a larger coverage of paths in...
Read more >
Paths and baseUrl in tsconfig.json - Medhat Dawoud
First: baseUrl. Which refers to the directory that you need your application to consider as a root directry or a base url, it's...
Read more >
paths and baseUrl | ts-node - TypeStrong · GitHub
You can use ts-node together with tsconfig-paths to load modules according to the paths section in tsconfig.json.
Read more >
Add baseUrl and paths in tsconfig.json and jsconfig.json #5645
One of the side-effects of setting baseUrl: "." , is that TypeScript now thinks you can import using an absolute path of "src/Foo"...
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