Skip to content

Commit

Permalink
chore: remove unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Feb 25, 2023
1 parent 5072f8c commit 159eb0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
3 changes: 0 additions & 3 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers {
conditions: ['style'],
tryIndex: false,
preferRelative: true,
isUnsafeExport: true,
}))
)
},
Expand All @@ -749,7 +748,6 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers {
tryIndex: true,
tryPrefix: '_',
preferRelative: true,
isUnsafeExport: true,
}))
)
},
Expand All @@ -763,7 +761,6 @@ function createCSSResolvers(config: ResolvedConfig): CSSAtImportResolvers {
conditions: ['less', 'style'],
tryIndex: false,
preferRelative: true,
isUnsafeExport: true,
}))
)
},
Expand Down
7 changes: 1 addition & 6 deletions packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ export interface InternalResolveOptions extends Required<ResolveOptions> {
skipPackageJson?: boolean
preferRelative?: boolean
isRequire?: boolean
isImport?: boolean
// When true, the export resolver should opt out of Node's default resolution conditions
isUnsafeExport?: boolean
// #3040
// when the importer is a ts module,
// if the specifier requests a non-existent `.js/jsx/mjs/cjs` file,
Expand Down Expand Up @@ -1104,8 +1101,7 @@ function resolveExports(
}
if (
(!overrideConditions || overrideConditions.has('module')) &&
!options.isRequire &&
!options.isUnsafeExport
!options.isRequire
) {
conditions.push('module')
}
Expand All @@ -1122,7 +1118,6 @@ function resolveExports(
const result = exports(pkg, key, {
browser: targetWeb && !conditions.includes('node'),
require: options.isRequire && !conditions.includes('import'),
unsafe: options.isUnsafeExport,
conditions,
})

Expand Down
7 changes: 3 additions & 4 deletions playground/css/css-dep-exports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"version": "1.0.0",
"exports": {
".": {
"import": "./index.js",
"sass": "./style.scss",
"style": "./style.css"
},
"./package.json": "./package.json"
"style": "./style.css",
"import": "./index.js"
}
}
}

0 comments on commit 159eb0a

Please sign in to comment.