You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting error in aliased import paths in package #563
Is this with the package.json imports field or the paths option in a tsconfig? Preconstruct (intentionally) doesn't resolve with paths in tsconfigs but the package.json imports field should work. If you're using the package.json imports field, could you provide a more complete reproduction?
I only did it on tsconfigs. But, I tried it on the imports field on package.json just now after you mentioned it. Unfortunately, it's still giving me an error.
Here's a reproduction of the package.json
This is added on the workspace level, and not on the root.
The imports field requires extensions so for example you need to import e.g. #package/path/to/component/something.ts or include the extension in the pattern like e.g.
(Note this requirement isn't a Preconstruct-specific thing, this is just how the imports field works in Node itself and a bunch of other tools that support Node-style module resolution such as e.g. TypeScript with the "moduleResolution":"nodenext"/"bundler" compiler option)
Activity
[-]Aliased import paths in package get an error[/-][+]Getting error in aliased import paths in package[/+]emmatown commentedon Jun 15, 2023
Is this with the package.json
importsfield or thepathsoption in a tsconfig? Preconstruct (intentionally) doesn't resolve withpathsin tsconfigs but the package.jsonimportsfield should work. If you're using the package.jsonimportsfield, could you provide a more complete reproduction?cdbenj commentedon Jun 15, 2023
Thanks @emmatown
I only did it on tsconfigs. But, I tried it on the imports field on package.json just now after you mentioned it. Unfortunately, it's still giving me an error.
Here's a reproduction of the package.json
This is added on the workspace level, and not on the root.
node version: 19.2.0
emmatown commentedon Jun 15, 2023
The
importsfield requires extensions so for example you need to import e.g.#package/path/to/component/something.tsor include the extension in the pattern like e.g.(Note this requirement isn't a Preconstruct-specific thing, this is just how the
importsfield works in Node itself and a bunch of other tools that support Node-style module resolution such as e.g. TypeScript with the"moduleResolution":"nodenext"/"bundler"compiler option)cdbenj commentedon Jun 15, 2023
I see. Let me try it then. Thanks for you guidance 👍