carbon-preprocess-svelte 0.11.18 → 0.11.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,9 +40,12 @@ const optimizeImports = () => {
|
|
|
40
40
|
case constants_1.CarbonSvelte.Components:
|
|
41
41
|
rewriteImport(s, node, ({ imported, local }) => {
|
|
42
42
|
var _a;
|
|
43
|
+
// Use index if available for backwards compatibility with special paths, like .js files.
|
|
44
|
+
// Otherwise, use optimistic path for new components.
|
|
43
45
|
const import_path = (_a = component_index_1.components[imported.name]) === null || _a === void 0 ? void 0 : _a.path;
|
|
44
|
-
if (!import_path)
|
|
45
|
-
return ""
|
|
46
|
+
if (!import_path) {
|
|
47
|
+
return `import ${local.name} from "${import_name}/src/${imported.name}/${imported.name}.svelte";`;
|
|
48
|
+
}
|
|
46
49
|
return `import ${local.name} from "${import_path}";`;
|
|
47
50
|
});
|
|
48
51
|
break;
|