I'm trying to do something very similar to the jquery path example in the documentation, but TS keeps throwing TS2307
(webpack compiles fine):
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@client": [
"client",
],
"@suir": [
"../node_modules/semantic-ui-react/dist/commonjs", // not working
],
},
// …
},
"include": [
"*.d.ts",
"client/**/*",
"../node_modules/semantic-ui-react", // is this necessary?
],
Changing baseUrl
to "."
and updating includes
and paths
makes no difference (@client
continues to work and @suir
continues to not work).
Changing "@suir"
to "@suir/"
or "@suir/*"
(and appending /*
to its value) also makes no difference.
The reason I'm doing this is to simplify my imports (I'm specifying them explicitly instead of pulling named exports from the bundle in order to reduce my vendor bundle size—saves about 1 MB):
import Button from 'semantic-ui-react/dist/commonjs/elements/Button'; // works
import Button from '@suir/elements/Button'; // not found
paths
stop working when i use thefiles
property in tsconfig.json. Any solution for this? – Cretaceous