diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8742/input/.swcrc new file mode 100644 index 000000000000..a2cea3ca7c0e --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/input/.swcrc @@ -0,0 +1,9 @@ +{ + "module": { + "type": "es6", + "resolveFully": true + }, + "jsc": { + "baseUrl": "." + } +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/input/global/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/input/global/index.js new file mode 100644 index 000000000000..3deda8047e15 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/input/global/index.js @@ -0,0 +1 @@ +export { } \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/input/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/input/index.js new file mode 100644 index 000000000000..50ad856a72be --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/input/index.js @@ -0,0 +1,9 @@ +// ====== +// SOURCE +// ====== +export { teamsDarkTheme, teamsHighContrastTheme, teamsLightTheme, webDarkTheme, webLightTheme } from './themes'; // 🚨 invalid directory path - wont work within browser +export { createDarkTheme, createHighContrastTheme, createLightTheme, createTeamsDarkTheme } from './utils'; // 🚨 invalid directory path - wont work within browser + +export { themeToTokensObject } from './themeToTokensObject'; +export { tokens } from './tokens'; +export { typographyStyles } from './global'; // 🚨 invalid directory path - wont work within browser \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/input/themeToTokensObject.js b/crates/swc/tests/fixture/issues-8xxx/8742/input/themeToTokensObject.js new file mode 100644 index 000000000000..f0a766d36b82 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/input/themeToTokensObject.js @@ -0,0 +1 @@ +export { } diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/input/themes/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/input/themes/index.js new file mode 100644 index 000000000000..3deda8047e15 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/input/themes/index.js @@ -0,0 +1 @@ +export { } \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/input/tokens.js b/crates/swc/tests/fixture/issues-8xxx/8742/input/tokens.js new file mode 100644 index 000000000000..3deda8047e15 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/input/tokens.js @@ -0,0 +1 @@ +export { } \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/input/utils/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/input/utils/index.js new file mode 100644 index 000000000000..f0a766d36b82 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/input/utils/index.js @@ -0,0 +1 @@ +export { } diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/output/global/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/output/global/index.js new file mode 100644 index 000000000000..2234b9cae16d --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/output/global/index.js @@ -0,0 +1 @@ +export { }; diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/output/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/output/index.js new file mode 100644 index 000000000000..971a2d901d87 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/output/index.js @@ -0,0 +1,8 @@ +// ====== +// SOURCE +// ====== +export { teamsDarkTheme, teamsHighContrastTheme, teamsLightTheme, webDarkTheme, webLightTheme } from "./themes/index.js"; // 🚨 invalid directory path - wont work within browser +export { createDarkTheme, createHighContrastTheme, createLightTheme, createTeamsDarkTheme } from "./utils/index.js"; // 🚨 invalid directory path - wont work within browser +export { themeToTokensObject } from "./themeToTokensObject.js"; +export { tokens } from "./tokens.js"; +export { typographyStyles } from "./global/index.js"; // 🚨 invalid directory path - wont work within browser diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/output/themeToTokensObject.js b/crates/swc/tests/fixture/issues-8xxx/8742/output/themeToTokensObject.js new file mode 100644 index 000000000000..2234b9cae16d --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/output/themeToTokensObject.js @@ -0,0 +1 @@ +export { }; diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/output/themes/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/output/themes/index.js new file mode 100644 index 000000000000..2234b9cae16d --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/output/themes/index.js @@ -0,0 +1 @@ +export { }; diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/output/tokens.js b/crates/swc/tests/fixture/issues-8xxx/8742/output/tokens.js new file mode 100644 index 000000000000..2234b9cae16d --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/output/tokens.js @@ -0,0 +1 @@ +export { }; diff --git a/crates/swc/tests/fixture/issues-8xxx/8742/output/utils/index.js b/crates/swc/tests/fixture/issues-8xxx/8742/output/utils/index.js new file mode 100644 index 000000000000..2234b9cae16d --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8742/output/utils/index.js @@ -0,0 +1 @@ +export { }; diff --git a/crates/swc_ecma_transforms_module/src/path.rs b/crates/swc_ecma_transforms_module/src/path.rs index 06ee744f46a7..f1ae18c17c78 100644 --- a/crates/swc_ecma_transforms_module/src/path.rs +++ b/crates/swc_ecma_transforms_module/src/path.rs @@ -173,7 +173,8 @@ where false }; - if orig_filename == "index" { + if self.config.resolve_fully && is_resolved_as_js { + } else if orig_filename == "index" { // Import: `./foo/index` // Resolved: `./foo/index.js`