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
rollupTypes: true
results in `Error: Internal Error: getResolvedModule() could not resolve module name "./myMainComponent"
#126
Comments
@qmhc Same error still with version 1.6.6 My export * from './mainWebComponent' But there is no such file in |
I think the cause maybe incorrect root config, would your |
That's my {
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
} and {
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite-app.config.ts", "vite-lib.config.ts"]
} Not sure, what you mean by "project struct"? It is a vite 3 structure under EDIT: {
"name": "ozgerde-vorgangsportal",
"private": true,
"version": "1.0.0",
"type": "module",
"files": [
"dist-lib"
],
"module": "./dist-lib/ozgerde-vorgangsportal.js",
"exports": {
".": {
"import": "./dist-lib/ozgerde-vorgangsportal.js"
}
},
"types": "./dist-lib/ozgerde-vorgangsportal.d.ts",
"scripts": {
"dev": "vite --config vite-app.config.ts",
"build": "npm run buildApp && npm run buildLib",
"buildApp": "tsc && vite --config vite-app.config.ts build",
"buildLib": "tsc && vite --config vite-lib.config.ts build",
"preview": "vite --config vite-app.config.ts preview"
},
"dependencies": {
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@mui/material": "^5.10.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "^1.3.0",
"unfetch": "^4.2.0"
},
"devDependencies": {
"@types/node": "^18.8.1",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^2.1.0",
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^4.6.4",
"vite": "^3.1.0",
"vite-plugin-dts": "^1.6.6"
}
} Error happens when calling |
You add |
Added these options, but I do not see any type errors in the output: $ npm run buildLib
> ozgerde-vorgangsportal@1.0.0 buildLib
> tsc && vite --config vite-lib.config.ts build
vite v3.1.0 building for production...
✓ 410 modules transformed.
dist-lib/ozgerde-vorgangsportal.js 126.24 KiB / gzip: 35.05 KiB
[vite:dts] Start generate declaration files...
[vite:dts] Start rollup declaration files...
error during build:
Error: Internal Error: getResolvedModule() could not resolve module name "./mainWebComponent"
/home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/dist-lib/ozgerde-vorgangsportal.d.ts:1:1
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
at ExportAnalyzer._fetchSpecifierAstModule (/home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:676:19)
at ExportAnalyzer.fetchAstModuleFromSourceFile (/home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:112:65)
at AstSymbolTable.fetchAstModuleFromWorkingPackage (/home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:83:37)
at Collector.analyze (/home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/@microsoft/api-extractor/lib/collector/Collector.js:155:51)
at rollupDeclarationFiles (file:///home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/vite-plugin-dts/dist/index.mjs:176858:13)
at Object.closeBundle (file:///home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/vite-plugin-dts/dist/index.mjs:177171:11)
at async Promise.all (index 0)
at async PluginDriver.hookParallel (file:///home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/rollup/dist/es/shared/rollup.js:22638:9)
at async Object.close (file:///home/jnachtigall/dev/erd/ozg-erde-formcycle/modules/vgp-frontend/vite-app/node_modules/rollup/dist/es/shared/rollup.js:23709:13)
at async Promise.all (index 0) I think the build error is because within export * from './mainWebComponent' But in |
Just strange, Would you mind sharing your project or provide a reproduction? |
I've set up a repo at https://github.com/jnachtigall/vite-plugin-dts-126-bug and sent you an invitation. You can toggle |
I see there is not any export in |
yes, the plan is that the lib is used in the consuming app with Even there's no export, the process should not error. |
You need to export something to make it as a moudle, such as |
Setting
rollupTypes: true
results inError: Internal Error: getResolvedModule() could not resolve module name ...
Without or commenting out
// rollupTypes: true,
it works.The text was updated successfully, but these errors were encountered: