Closed
Description
What happens and why it is wrong
When trying to build a project installed with pnpm
, rpt2
fails to resolve the created symlinked dependencies in node_modules
(non-flat).
Setting check: false
is (arguably) a workaround.
Reproduction
Repository: https://github.com/davelsan/rpt2-pnpm-symlinks
Config: https://github.com/davelsan/rpt2-pnpm-symlinks/blob/master/rollup.config.js
The provided repro is a minimal vue3
plugin that imports the App
interface from vue
in index.ts
import { App } from 'vue'
This import causes the following error on build:
[!] (plugin rpt2) Error: semantic error TS2305: Module '"../node_modules/vue/dist/vue"' has no exported member 'App'.
Setting the check
option to false
in rollup.config.js
eliminates the error.
Versions
- typescript: 4.2.3
- rollup: 2.41.5
- rollup-plugin-typescript2: 0.30.0
rollup.config.js
import path from 'path';
import rpt2 from 'rollup-plugin-typescript2';
import pkgJson from './package.json';
export default {
input: './src/index.ts',
external: ['vue'],
plugins: [
rpt2({
check: true,
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
})
],
output: [
{
file: pkgJson.browser, // dist/index.esm.js
format: 'es',
sourcemap: true,
},
],
}
tsconfig.json
A snippet with the relevant module resolution options only.
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
}
}
package.json
A snippet with the relevant dependencies only.
{
"peerDependencies": {
"vue": "^3.0.7"
},
"devDependencies": {
"rollup": "^2.41.5",
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.2.3",
"vue": "^3.0.7"
}
}