Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions packages/wxt/src/core/resolve-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,18 @@ export async function resolveConfig(
defaults: userConfig.webExt ?? userConfig.runner,
});
// Make sure alias are absolute
const alias = Object.fromEntries(
Object.entries({
...mergedConfig.alias,
'@': srcDir,
'~': srcDir,
'@@': root,
'~~': root,
}).map(([key, value]) => [key, path.resolve(root, value)]),
);
const alias =
mergedConfig.alias !== false
? Object.fromEntries(
Object.entries({
...mergedConfig.alias,
'@': srcDir,
'~': srcDir,
'@@': root,
'~~': root,
}).map(([key, value]) => [key, path.resolve(root, value)]),
)
: {};

let devServerConfig: ResolvedConfig['dev']['server'];
if (command === 'serve') {
Expand Down
4 changes: 3 additions & 1 deletion packages/wxt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,14 @@ export interface InlineConfig {
*
* The key is the import alias and the value is either a relative path to the root directory or an absolute path.
*
* Set to `false` to disable aliases, including the default ones. This is useful if you want to handle aliases in your own plugin. Note that WXT modules can still add aliases.
*
* @example
* {
* "testing": "src/utils/testing.ts"
* }
*/
alias?: Record<string, string>;
alias?: Record<string, string> | false;
/**
* Experimental settings - use with caution.
*/
Expand Down