Repository navigation
[!] (plugin typescript) Error: Could not load ...\excludeTitle.json: Debug Failure. #1789
|
How to fix [!] (plugin typescript) Error: Could not load D:\Repositories\static-blog-generator\packages\sbg-cli\src\import\blogger\excludeTitle.json: Debug Failure. here my rollup.config.js import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import fs from 'fs-extra';
import * as glob from 'glob';
import url from 'node:url';
import path from 'path';
import { external, tsconfig } from './rollup.utils.js';
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
/**
* @type {import('./package.json')}
*/
const { author, version, name } = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8'));
const year = new Date().getFullYear();
const banner = `// ${name} v${version} Copyright (c) ${year} ${author}`;
/**
* @type {import('rollup').RollupOptions['input']}
*/
const inputs = glob.globSync('src/**/*.{ts,js,cjs,mjs,json}', {
posix: true,
ignore: tsconfig.exclude.concat('*.runner.*', '*.explicit.*', '*.test.*', '*.builder.*', '*.spec.*')
});
const plugins = [
json(),
typescript({
tsconfig: false,
compilerOptions: tsconfig.compilerOptions,
include: ['./src/**/*'],
exclude: tsconfig.exclude,
resolveJsonModule: true,
resolvePackageJsonImports: true,
resolvePackageJsonExports: true
}), // Compile TypeScript files
resolve({ preferBuiltins: true }),
commonjs()
];
/**
* @type {import('rollup').RollupOptions}
*/
const _partials = {
input: inputs,
output: [
{
dir: 'dist',
format: 'esm',
sourcemap: false,
preserveModules: true,
exports: 'named',
globals: {
hexo: 'hexo'
},
banner
},
{
dir: 'dist',
format: 'cjs',
sourcemap: false,
preserveModules: true,
exports: 'named',
entryFileNames: '[name].cjs',
globals: {
hexo: 'hexo'
},
banner
},
{
dir: 'dist',
format: 'esm',
sourcemap: false,
preserveModules: true,
exports: 'named',
entryFileNames: '[name].mjs',
globals: {
hexo: 'hexo'
},
banner
}
],
plugins,
external // External dependencies package name to exclude from bundle
};tsconfig.json {
"extends": "@tsconfig/node16/tsconfig.json",
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node",
"compilerOptions": {
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
}
},
"compilerOptions": {
/* Basic Options */
"target": "ES2020",
"module": "ESNext",
"lib": ["ES2019", "ES2020", "DOM", "ES6"],
"outDir": "./dist",
"allowJs": true,
"checkJs": false,
"resolveJsonModule": true,
"downlevelIteration": true,
"noImplicitAny": false,
/* Strict Type-Checking Options */
"strict": true,
/* Module Resolution Options */
"allowSyntheticDefaultImports": true,
"moduleResolution": "Bundler",
"esModuleInterop": true,
/* Advanced Options */
"forceConsistentCasingInFileNames": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true
},
"exclude": ["**/dist/**", "**/node_modules/**", "**/tmp/**"]
} |
Replies: 1 comment
|
I can reproduce this class of const plugins = [
json(),
typescript({
tsconfig: './tsconfig.json',
// Let plugin-json handle JSON modules; this filter is for code files.
include: ['./src/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}'],
exclude: tsconfig.exclude,
}),
resolve({ preferBuiltins: true }),
commonjs(),
];Keep I tested a minimal project with a typed
With The plugin's These checks ran on Linux / Node 24.22.1, with plugin-json 6.1.0. I have not run your Windows repository or its |
I can reproduce this class of
Debug Failurewith the combination oftsconfig: false,outDir, and the TypeScript plugin's output-file lookup. Loading the actual tsconfig is worth trying before changing the JSON data:Keep
resolveJsonModule: truein the actual tsconfig so TypeScript can type-check JSON imports. You do not need to copycompilerOptionsinto the plugin if the file already contain…