`ENOENT: no such file or directory, open '...?rollup-plugin-vue=script.d.ts'`
See original GitHub issueWhat happens and why it is wrong
Get this error when using with rollup-plugin-vue
when set declaration
to true
in tsconfig.json
.
Error: ENOENT: no such file or directory, open '<path to project directory>\dist\components\Hello.vue?rollup-plugin-vue=script.d.ts'
Repo to Repro: https://github.com/gluons/rollup-plugin-typescript2-issue-97
Environment
OS: Windows 10 Node: v10.4.1 Yarn: 1.7.0
Versions
- typescript: 2.8.4
- rollup: 0.62.0
- rollup-plugin-typescript2: 0.15.1
rollup.config.js
import { resolve } from 'path';
import ts from 'rollup-plugin-typescript2';
import vue from 'rollup-plugin-vue';
export default {
input: resolve(__dirname, './src/index.ts'),
output: [
{
file: resolve(__dirname, './dist/hello-plugin.umd.js'),
format: 'umd',
sourcemap: true,
name: 'HelloPlugin',
globals: {
vue: 'Vue'
}
},
{
file: resolve(__dirname, './dist/hello-plugin.es.js'),
format: 'es',
sourcemap: true
}
],
plugins: [
ts({
verbosity: 3 // Debug
}),
vue()
],
external: ['vue']
};
tsconfig.json
{
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"target": "es5",
"lib": [
"dom",
"es2015"
],
"esModuleInterop": true,
"sourceMap": true,
"declaration": true
},
"include": [
"src"
]
}
package.json
{
"name": "rolup-vue-ts-issue",
"version": "0.0.0",
"description": "A repo to repro Rollup + Vue + TypeScript with declaration bundling issue.",
"private": true,
"scripts": {
"prebuild": "rimraf dist/*",
"build": "rollup -c rollup.config.ts"
},
"author": "Saran Tanpituckpong <sarunta@gmail.com>",
"license": "UNLICENSED",
"devDependencies": {
"@types/node": "8",
"postcss": "^6.0.23",
"rimraf": "^2.6.2",
"rollup": "^0.62.0",
"rollup-plugin-typescript2": "^0.15.1",
"rollup-plugin-vue": "^4.3.0",
"typescript": "~2.8",
"vue-template-compiler": "^2.5.16"
},
"dependencies": {
"vue": "^2.5.16"
}
}
plugin output with verbosity 3
rpt2: typescript version: 2.8.4
rpt2: tslib version: 1.9.2
rpt2: rollup-plugin-typescript2 version: 0.15.1
rpt2: plugin options:
{
"verbosity": 3,
"check": true,
"clean": false,
"cacheRoot": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue/.rpt2_cache",
"include": [
"*.ts+(|x)",
"**/*.ts+(|x)"
],
"exclude": [
"*.d.ts",
"**/*.d.ts"
],
"abortOnError": true,
"rollupCommonJSResolveHack": false,
"typescript": "version 2.8.4",
"useTsconfigDeclarationDir": false,
"tsconfigOverride": {},
"transformers": [],
"tsconfigDefaults": {}
}
rpt2: rollup config:
{
"external": [
"vue",
"",
""
],
"inlineDynamicImports": false,
"input": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue\\src\\index.ts",
"chunkGroupingSize": 5000,
"perf": false,
"plugins": [
{
"name": "rpt2"
},
{
"name": "VuePlugin"
}
],
"entry": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue\\src\\index.ts"
}
rpt2: built-in options overrides: {
"noEmitHelpers": false,
"importHelpers": true,
"noResolve": false,
"noEmit": false,
"inlineSourceMap": false,
"outDir": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue/.rpt2_cache/placeholder",
"moduleResolution": 2,
"declarationDir": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue"
}
rpt2: parsed tsconfig: {
"options": {
"module": 5,
"moduleResolution": 2,
"target": 1,
"lib": [
"lib.dom.d.ts",
"lib.es2015.d.ts"
],
"esModuleInterop": true,
"sourceMap": true,
"declaration": true,
"noEmitHelpers": false,
"importHelpers": true,
"noResolve": false,
"noEmit": false,
"inlineSourceMap": false,
"outDir": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue/.rpt2_cache/placeholder",
"declarationDir": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue",
"configFilePath": "C:\\Users\\Saran\\my-projects\\rolup-vue-ts-issue/tsconfig.json"
},
"fileNames": [
"C:/Users/Saran/my-projects/rolup-vue-ts-issue/src/index.ts",
"C:/Users/Saran/my-projects/rolup-vue-ts-issue/src/sfc.d.ts"
],
"typeAcquisition": {
"enable": false,
"include": [],
"exclude": []
},
"raw": {
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"target": "es5",
"lib": [
"dom",
"es2015"
],
"esModuleInterop": true,
"sourceMap": true,
"declaration": true
},
"include": [
"src"
]
},
"errors": [],
"wildcardDirectories": {
"C:/Users/Saran/my-projects/rolup-vue-ts-issue/src": 1
},
"compileOnSave": false,
"configFileSpecs": {
"includeSpecs": [
"src"
],
"validatedIncludeSpecs": [
"src"
],
"wildcardDirectories": {
"C:/Users/Saran/my-projects/rolup-vue-ts-issue/src": 1
}
}
}
rpt2: included:
'[
"*.ts+(|x)",
"**/*.ts+(|x)"
]'
rpt2: excluded:
'[
"*.d.ts",
"**/*.d.ts"
]'
rpt2: Ambient types:
rpt2: C:/Users/Saran/my-projects/rolup-vue-ts-issue/src/sfc.d.ts
rpt2: C:/Users/Saran/my-projects/rolup-vue-ts-issue/node_modules/@types/estree/index.d.ts
rpt2: C:/Users/Saran/my-projects/rolup-vue-ts-issue/node_modules/@types/node/index.d.ts
rpt2: ambient types changed, redoing all semantic diagnostics
rpt2: transpiling 'C:\Users\Saran\my-projects\rolup-vue-ts-issue\src\index.ts'
rpt2: cache: 'C:\Users\Saran\my-projects\rolup-vue-ts-issue/.rpt2_cache/022f423b186edc509d0bfc04874ea603a25c1eb2/code/cache/9d9555d93b34027372939bd4a0a4dc41c41e13ac'
rpt2: cache miss
rpt2: cache: 'C:\Users\Saran\my-projects\rolup-vue-ts-issue/.rpt2_cache/022f423b186edc509d0bfc04874ea603a25c1eb2/syntacticDiagnostics/cache/9d9555d93b34027372939bd4a0a4dc41c41e13ac'
rpt2: cache miss
rpt2: cache: 'C:\Users\Saran\my-projects\rolup-vue-ts-issue/.rpt2_cache/022f423b186edc509d0bfc04874ea603a25c1eb2/semanticDiagnostics/cache/9d9555d93b34027372939bd4a0a4dc41c41e13ac'
rpt2: cache miss
rpt2: generated declarations for 'C:/Users/Saran/my-projects/rolup-vue-ts-issue/src/index.ts'
rpt2: transpiling 'C:\Users\Saran\my-projects\rolup-vue-ts-issue\src\components\Hello.vue?rollup-plugin-vue=script.ts'
rpt2: cache: 'C:\Users\Saran\my-projects\rolup-vue-ts-issue/.rpt2_cache/022f423b186edc509d0bfc04874ea603a25c1eb2/code/cache/53ea992621b40f9ced3a2ea5f2f0b86e2cb028b1'
rpt2: cache miss
rpt2: cache: 'C:\Users\Saran\my-projects\rolup-vue-ts-issue/.rpt2_cache/022f423b186edc509d0bfc04874ea603a25c1eb2/syntacticDiagnostics/cache/53ea992621b40f9ced3a2ea5f2f0b86e2cb028b1'
rpt2: cache miss
rpt2: cache: 'C:\Users\Saran\my-projects\rolup-vue-ts-issue/.rpt2_cache/022f423b186edc509d0bfc04874ea603a25c1eb2/semanticDiagnostics/cache/53ea992621b40f9ced3a2ea5f2f0b86e2cb028b1'
rpt2: cache miss
rpt2: generated declarations for 'C:/Users/Saran/my-projects/rolup-vue-ts-issue/src/components/Hello.vue?rollup-plugin-vue=script.ts'
rpt2: generating target 1
rpt2: rolling caches
rpt2: writing declarations for 'C:/Users/Saran/my-projects/rolup-vue-ts-issue/src/index.ts' to 'C:\Users\Saran\my-projects\rolup-vue-ts-issue\dist\index.d.ts'
rpt2: writing declarations for 'C:/Users/Saran/my-projects/rolup-vue-ts-issue/src/components/Hello.vue?rollup-plugin-vue=script.ts' to 'C:\Users\Saran\my-projects\rolup-vue-ts-issue\dist\components\Hello.vue?rollup-plugin-vue=script.d.ts'
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
rollup-plugin-dts - npm
This is a plugin that lets you roll-up your .d.ts definition files. Usage. Install the package from npm : $ npm install --save-dev ......
Read more >How to resolve Nodejs: Error: ENOENT: no such file or directory
I was facing this issue with ng-package.json file, while creating a plugin. I found ...
Read more >Build a component library with React and TypeScript
Learn to create a component library with React and TypeScript in this in-depth tutorial that includes testing and deploying to npm.
Read more >Common Error Details - Snowpack
ENOENT : no such file or directory, open …/node_modules/csstype/index.js. This error message would sometimes occur in older versions of Snowpack.
Read more >How to Create and Publish a React Component Library
You should have three index.ts files, and a Button.tsx file ... from "@rollup/plugin-typescript"; import dts from "rollup-plugin-dts"; ...
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 FreeTop 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
Top GitHub Comments
Ok, try the master now. There is still a problem of
//# sourceMappingURL=
and .d.ts.map map itself referencing full block name, which will likely confuse some tools.@znck can a single vue file contain multiple typescript blocks and will vue plugin turn them into separate virtual modules?
There would be only one script (typescript) block per file.