resolve.alias doesn't work is this plugin
See original GitHub issueHello !
It looks like aliases are not correctly transformed in d.ts files… All the JavaScript code is ok. It’s just my d.ts files.

Here my vite config :
import { defineConfig } from 'vitest/config'
import tsconfigPaths from 'vite-tsconfig-paths'
import react from '@vitejs/plugin-react'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import dts from 'vite-plugin-dts'
const path = require('path')
// https://vitejs.dev/config/
export default defineConfig({
test: {
environment: 'jsdom',
globals: true
},
build: {
sourcemap: true,
target: 'esnext',
minify: false,
lib: {
entry: path.resolve(__dirname, 'src/index.tsx'),
name: 'Mui-phone-number',
fileName: format => `mui-phone-number.${format}.js`
},
rollupOptions: {
output: {
sourcemapExcludeSources: true,
globals: {
react: 'React',
'@mui/material/InputAdornment': 'InputAdornment',
'@mui/material/TextField': 'TextField',
'@mui/material/IconButton': 'IconButton',
'@mui/material/styles': 'styles',
'react/jsx-runtime': 'jsxRuntime',
'@mui/material/Menu': 'Menu',
'@mui/material/MenuItem': 'MenuItem',
'@mui/material/Typography': 'Typography',
'@mui/material/ListItemIcon': 'ListItemIcon',
'@mui/material/ListItemText': 'ListItemText'
}
}
}
},
plugins: [
peerDepsExternal(),
react(),
tsconfigPaths(),
dts({
insertTypesEntry: true
})
]
})
Is anyone has the same issue ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Webpack resolve.alias does not work with typescript?
I am using Babel 7 with babel-plugin-module-resolver to resolve aliases. No ts-loader or awesome-typescript-loader as Babel 7 supports TypeScript out of the box ......
Read more >Resolve | webpack
An object which maps extension to extension aliases. webpack.config.js module.exports = { //... resolve: ...
Read more >@rollup/plugin-alias - npm
This is plugin mimics the resolve.extensions and resolve.alias functionality in Webpack. This plugin will work for any file type that Rollup ...
Read more >Can't resolve path alias : r/reactjs - Reddit
I'm trying to use alias for paths but I can't seem to get it to work I keep getting this error even though...
Read more >Import Aliases in Vite - Vue School Blog
Vite takes a resolve.alias config option that it passes on to @rollup/plugin-alias as it's entries option. All that's needed is to pass it ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I initially think this may be some unrobust when using with the
vite-tsconfig-paths
.Normally it is as expected when using
resolve.alias
in the vite config file.This is one of the main tasks for next version, I still need more time for futher testing, thanks for your patience.
@viclafouch would you mind sharing your config? It seems like emitted typescript declarations do not work with
vite-aliases
.