Skip to content
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

watch mode Error: Could not find source file #408

Closed
skagur-k opened this issue Jul 31, 2022 · 3 comments · Fixed by #364
Closed

watch mode Error: Could not find source file #408

skagur-k opened this issue Jul 31, 2022 · 3 comments · Fixed by #364
Labels
kind: regression Specific type of bug -- past behavior that worked is now broken problem: removed issue template OP removed the issue template without good cause scope: watch mode Related to Rollup's watch mode solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue

Comments

@skagur-k
Copy link

skagur-k commented Jul 31, 2022

What happens and why it is incorrect

Rollup watch mode emits the following error:
(plugin rpt2) Error: Could not find source file: '/home/skagur/dev/rpt2-repro/index.ts'

Repository for the reproduction of the errror:
Reproduction repo

Possibly related to #214

Environment

Versions

Binaries:
    Node: 18.4.0 - /home/linuxbrew/.linuxbrew/bin/node
    Yarn: 1.23.0-20220130.1630 - /home/linuxbrew/.linuxbrew/bin/yarn
    npm: 8.12.1 - /home/linuxbrew/.linuxbrew/bin/npm
  npmPackages:
    rollup: ^2.77.2 => 2.77.2 
    rollup-plugin-typescript2: ^0.32.1 => 0.32.1 
    typescript: ^4.7.4 => 4.7.4 
  npmGlobalPackages:
    typescript: 4.7.4

rollup.config.js

:
// rollup.config.js

import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from 'rollup-plugin-typescript2'
import postCSS from 'rollup-plugin-postcss'
import pkg from './package.json'
import bundleSize from 'rollup-plugin-bundle-size'
import analyzer from 'rollup-plugin-visualizer'

const devMode = process.env.NODE_ENV === 'development'
console.log(`${devMode ? 'development' : 'production'} mode bundle`)

export default {
	input: './index.ts',
	output: [
		{
			file: pkg.main,
			format: 'cjs',
			sourcemap: devMode ? 'inline' : false,
		},
		{
			file: pkg.module,
			format: 'es',
			sourcemap: devMode ? 'inline' : false,
		},
	],
	external: [...Object.keys(pkg.peerDependencies || {})],
	plugins: [
		nodeResolve(),
		commonjs(),
		typescript({
			typescript: require('typescript'),
		}),
		postCSS({
			plugins: [require('autoprefixer')],
		}),
		bundleSize(),
		analyzer(),
	],
}

tsconfig.json

:
{
	"$schema": "https://json.schemastore.org/tsconfig",
	"display": "Default",
	"compilerOptions": {
		"composite": false,
		"declaration": true,
		"declarationMap": false,
		"declarationDir": "dist/types",
		"esModuleInterop": true,
		"forceConsistentCasingInFileNames": true,
		"inlineSources": false,
		"isolatedModules": true,
		"moduleResolution": "node",
		"noUnusedLocals": true,
		"noUnusedParameters": true,
		"skipLibCheck": true,
		"strict": true,
		"outDir": "dist/esm",
		"jsx": "react-jsx",
		"lib": ["ES2016", "ES2017", "DOM", "es6"],
		"module": "ESNext",
		"target": "es5",
		"noImplicitReturns": true,
		"noImplicitThis": true,
		"noImplicitAny": true,
		"strictNullChecks": true,
		"suppressImplicitAnyIndexErrors": true,
		"allowSyntheticDefaultImports": true,
		"typeRoots": ["./node_modules/@types"]
	},
	"include": ["src/**/*", "../tsconfig/global.d.ts"],
	"exclude": ["dist", "build", "node_modules"]
}

package.json

:
{
	"name": "@skaui/treeview",
	"version": "1.0.0",
	"description": "SKA UI - TreeView",
	"main": "./dist/cjs/index.js",
	"module": "./dist/esm/index.mjs",
	"types": "./dist/types/index.d.ts",
	"files": [
		"./dist"
	],
	"sideEffects": false,
	"scripts": {
		"dev": "rollup -c -w"
	},
	"keywords": [],
	"author": "Nam Hyuck Kim ([email protected])",
	"license": "ISC",
	"devDependencies": {
		"@rollup/plugin-commonjs": "^22.0.1",
		"@rollup/plugin-node-resolve": "^13.3.0",
		"@rollup/plugin-typescript": "^8.3.4",
		"@types/react": "^18.0.15",
		"autoprefixer": "^10.4.7",
		"postcss": "^8.4.14",
		"react": "^18.2.0",
		"react-dom": "18.2.0",
		"rollup": "^2.77.2",
		"rollup-plugin-bundle-size": "^1.0.3",
		"rollup-plugin-postcss": "^4.0.2",
		"rollup-plugin-typescript2": "^0.32.1",
		"rollup-plugin-visualizer": "^5.7.1",
		"tailwindcss": "^3.1.6",
		"typescript": "^4.7.4"
	},
	"peerDependencies": {
		"react": "^17.2.0",
		"react-dom": "^17.2.0"
	}
}

plugin output with verbosity 3

:
rpt2: built-in options overrides: {
    "noEmitHelpers": false,
    "importHelpers": true,
    "noResolve": false,
    "noEmit": false,
    "noEmitOnError": false,
    "inlineSourceMap": false,
    "outDir": "/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/placeholder",
    "moduleResolution": 2,
    "allowNonTsExtensions": true
}
rpt2: parsed tsconfig: {
    "options": {
        "composite": false,
        "declaration": true,
        "declarationMap": false,
        "esModuleInterop": true,
        "forceConsistentCasingInFileNames": true,
        "inlineSources": false,
        "isolatedModules": true,
        "moduleResolution": 2,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "skipLibCheck": true,
        "strict": true,
        "outDir": "/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/placeholder",
        "jsx": 4,
        "lib": [
            "lib.es2016.d.ts",
            "lib.es2017.d.ts",
            "lib.dom.d.ts",
            "lib.es2015.d.ts"
        ],
        "module": 99,
        "target": 1,
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "noImplicitAny": true,
        "strictNullChecks": true,
        "suppressImplicitAnyIndexErrors": true,
        "allowSyntheticDefaultImports": true,
        "typeRoots": [
            "/home/skagur/dev/rpt2-repro/node_modules/@types"
        ],
        "configFilePath": "/home/skagur/dev/rpt2-repro/tsconfig.json",
        "noEmitHelpers": false,
        "importHelpers": true,
        "noResolve": false,
        "noEmit": false,
        "noEmitOnError": false,
        "inlineSourceMap": false,
        "allowNonTsExtensions": true
    },
    "fileNames": [
        "/home/skagur/dev/rpt2-repro/src/Button.tsx",
        "/home/skagur/dev/rpt2-repro/src/global.d.ts",
        "/home/skagur/dev/rpt2-repro/src/index.ts"
    ],
    "typeAcquisition": {
        "enable": false,
        "include": [],
        "exclude": []
    },
    "raw": {
        "$schema": "https://json.schemastore.org/tsconfig",
        "display": "Default",
        "compilerOptions": {
            "composite": false,
            "declaration": true,
            "declarationMap": false,
            "declarationDir": "dist/types",
            "esModuleInterop": true,
            "forceConsistentCasingInFileNames": true,
            "inlineSources": false,
            "isolatedModules": true,
            "moduleResolution": "node",
            "noUnusedLocals": true,
            "noUnusedParameters": true,
            "skipLibCheck": true,
            "strict": true,
            "outDir": "dist/esm",
            "jsx": "react-jsx",
            "lib": [
                "ES2016",
                "ES2017",
                "DOM",
                "es6"
            ],
            "module": "ESNext",
            "target": "es5",
            "noImplicitReturns": true,
            "noImplicitThis": true,
            "noImplicitAny": true,
            "strictNullChecks": true,
            "suppressImplicitAnyIndexErrors": true,
            "allowSyntheticDefaultImports": true,
            "typeRoots": [
                "./node_modules/@types"
            ]
        },
        "include": [
            "src/**/*",
            "../tsconfig/global.d.ts"
        ],
        "exclude": [
            "dist",
            "build",
            "node_modules"
        ],
        "compileOnSave": false
    },
    "errors": [],
    "wildcardDirectories": {
        "/home/skagur/dev/rpt2-repro/src": 1
    },
    "compileOnSave": false
}
rpt2: included:
[
    "*.ts+(|x)",
    "**/*.ts+(|x)"
]
rpt2: excluded:
[
    "*.d.ts",
    "**/*.d.ts"
]
rpt2: transpiling '/home/skagur/dev/rpt2-repro/src/index.ts'
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/code/cache/e827b637ff444b424d1c753c7c57ddbf8eae8195'
rpt2:     cache miss
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/syntacticDiagnostics/cache/e827b637ff444b424d1c753c7c57ddbf8eae8195'
rpt2:     cache miss
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/semanticDiagnostics/cache/e827b637ff444b424d1c753c7c57ddbf8eae8195'
rpt2:     cache miss
rpt2:     watching: /home/skagur/dev/rpt2-repro/src/Button.tsx
rpt2: generated declarations for '/home/skagur/dev/rpt2-repro/src/index.ts'
rpt2: dependency '/home/skagur/dev/rpt2-repro/src/Button.tsx'
rpt2:     imported by '/home/skagur/dev/rpt2-repro/src/index.ts'
rpt2: resolving './Button' imported by '/home/skagur/dev/rpt2-repro/src/index.ts'
rpt2:     to '/home/skagur/dev/rpt2-repro/src/Button.tsx'
rpt2: transpiling '/home/skagur/dev/rpt2-repro/src/Button.tsx'
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/code/cache/e08ba165e1bbdf15434ff4b59bdb19e99e3ed886'
rpt2:     cache miss
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/syntacticDiagnostics/cache/e08ba165e1bbdf15434ff4b59bdb19e99e3ed886'
rpt2:     cache miss
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/semanticDiagnostics/cache/e08ba165e1bbdf15434ff4b59bdb19e99e3ed886'
rpt2:     cache miss
rpt2:     watching: 
rpt2: generated declarations for '/home/skagur/dev/rpt2-repro/src/Button.tsx'
rpt2: resolving '/home/skagur/dev/rpt2-repro/node_modules/tslib/tslib.es6.js' imported by '/home/skagur/dev/rpt2-repro/src/Button.tsx'
rpt2:     to '/home/skagur/dev/rpt2-repro/node_modules/tslib/tslib.es6.js'
rpt2: resolving '/home/skagur/dev/rpt2-repro/node_modules/react/jsx-runtime.js' imported by '/home/skagur/dev/rpt2-repro/src/Button.tsx'
rpt2:     to '/home/skagur/dev/rpt2-repro/node_modules/react/jsx-runtime.js'
rpt2: generating target 1
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/syntacticDiagnostics/cache/0a37055cfdc1aaa6994c5c4e7660f2f9be84848d'
rpt2:     cache miss
rpt2: generating target 1
rpt2:     cache: '/home/skagur/dev/rpt2-repro/node_modules/.cache/rollup-plugin-typescript2/rpt2_2e251205a01feeeabda92056ef5763ec288bad10/syntacticDiagnostics/cache/0a37055cfdc1aaa6994c5c4e7660f2f9be84848d'
rpt2:     cache miss
[!] (plugin rpt2) Error: Could not find source file: '/home/skagur/dev/rpt2-repro/index.ts'.
@agilgur5 agilgur5 added the problem: removed issue template OP removed the issue template without good cause label Jul 31, 2022
@agilgur5 agilgur5 changed the title Rollup watch mode emits (plugin rpt2) Error: Could not find source file watch mode Error: Could not find source file Jul 31, 2022
@agilgur5 agilgur5 added the scope: watch mode Related to Rollup's watch mode label Jul 31, 2022
@agilgur5
Copy link
Collaborator

agilgur5 commented Jul 31, 2022

Possible duplicate of #271, which was recently fixed by #364, but hasn't been released yet (looking to do a release very soon, though I don't have publishing permissions)

@skagur-k
Copy link
Author

skagur-k commented Aug 1, 2022

Thanks for the response. Good luck on the next release!

@agilgur5
Copy link
Collaborator

#364 has been released in 0.33.0

I confirmed in your repro that with 0.33.0 the error is no longer present, so this indeed turns out to be a duplicate of #271 .

@agilgur5 agilgur5 added solution: duplicate This issue or pull request already exists kind: regression Specific type of bug -- past behavior that worked is now broken solution: workaround available There is a workaround available for this issue and removed priority: in progress labels Aug 23, 2022
@agilgur5 agilgur5 linked a pull request Aug 23, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: regression Specific type of bug -- past behavior that worked is now broken problem: removed issue template OP removed the issue template without good cause scope: watch mode Related to Rollup's watch mode solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants