fix(TS)!: Update .wxt/tsconfig.json compiler options, require TS >=5.4 (#2512)
BREAKING CHANGE: Updates `.wxt/tsconfig.json` defaults to latest recommended settings for vite projects and requires Typescript 5.4 or later. See #2512 for details on what compiler options were changed. Co-authored-by: cookesan <cookesan@users.noreply.github.com>
This commit is contained in:
@@ -324,15 +324,23 @@ describe('TypeScript Project', () => {
|
||||
----------------------------------------
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"moduleResolution": "Bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"paths": {
|
||||
"@": [
|
||||
".."
|
||||
@@ -406,15 +414,23 @@ describe('TypeScript Project', () => {
|
||||
----------------------------------------
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"moduleResolution": "Bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"paths": {
|
||||
"@": [
|
||||
"../src"
|
||||
@@ -473,15 +489,23 @@ describe('TypeScript Project', () => {
|
||||
----------------------------------------
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"moduleResolution": "Bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"paths": {
|
||||
"example": [
|
||||
"../example"
|
||||
|
||||
@@ -58,7 +58,8 @@
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||
"vite": "^6.3.4 || ^7.0.0 || ^8.0.0-0",
|
||||
"web-ext": ">=9.2.0"
|
||||
"web-ext": ">=9.2.0",
|
||||
"typescript": ">=5.4"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"eslint": {
|
||||
@@ -66,6 +67,9 @@
|
||||
},
|
||||
"web-ext": {
|
||||
"optional": true
|
||||
},
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -297,15 +297,23 @@ async function getTsConfigEntry(): Promise<WxtDirFileEntry> {
|
||||
|
||||
const tsconfig = {
|
||||
compilerOptions: {
|
||||
// Environment setup & latest features
|
||||
lib: ['ESNext', 'DOM', 'DOM.Iterable'],
|
||||
target: 'ESNext',
|
||||
module: 'ESNext',
|
||||
module: 'Preserve',
|
||||
moduleDetection: 'force',
|
||||
// Bundler mode
|
||||
moduleResolution: 'Bundler',
|
||||
allowImportingTsExtensions: true,
|
||||
verbatimModuleSyntax: true,
|
||||
noEmit: true,
|
||||
esModuleInterop: true,
|
||||
forceConsistentCasingInFileNames: true,
|
||||
resolveJsonModule: true,
|
||||
// Best practices
|
||||
strict: true,
|
||||
skipLibCheck: true,
|
||||
noFallthroughCasesInSwitch: true,
|
||||
noUncheckedIndexedAccess: true,
|
||||
noImplicitOverride: true,
|
||||
// Project settings
|
||||
paths,
|
||||
},
|
||||
include: [`${getTsconfigPath(wxt.config.root)}/**/*`, './wxt.d.ts'],
|
||||
|
||||
Reference in New Issue
Block a user