fix: emit section scripts alongside styles
This commit is contained in:
+13
-19
@@ -124,27 +124,21 @@ export const collectEntries = (sourceDir, config) => {
|
|||||||
const relativeSpecPath = normalizePath(relative(sourceRoot, absolutePath));
|
const relativeSpecPath = normalizePath(relative(sourceRoot, absolutePath));
|
||||||
const isComponentSpec = relativeSpecPath.startsWith(`${config.paths.components}/`);
|
const isComponentSpec = relativeSpecPath.startsWith(`${config.paths.components}/`);
|
||||||
|
|
||||||
for (const extension of ['.scss', '.css', '.js']) {
|
if (!isComponentSpec) {
|
||||||
const isStyle = styleExtensions.includes(extension);
|
const styleEntry = findFirstExistingStyle(
|
||||||
|
sourceRoot,
|
||||||
if (isComponentSpec && isStyle) {
|
normalizePath(relative(sourceRoot, join(componentDir, `${stem}.css`)))
|
||||||
continue;
|
);
|
||||||
|
if (styleEntry) {
|
||||||
|
entries[normalizePath(styleEntry.relativePath)] = styleEntry.absolutePath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const entryPath = join(componentDir, `${stem}${extension}`);
|
const scriptPath = join(componentDir, `${stem}.js`);
|
||||||
if (!existsSync(entryPath)) {
|
if (existsSync(scriptPath)) {
|
||||||
continue;
|
if (!isComponentSpec || hasRuntimeSelfRegistration(scriptPath)) {
|
||||||
}
|
const relativePath = normalizePath(relative(sourceRoot, scriptPath));
|
||||||
|
entries[relativePath.slice(0, -extname(relativePath).length)] = scriptPath;
|
||||||
if (isComponentSpec && extension === '.js' && !hasRuntimeSelfRegistration(entryPath)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const relativePath = normalizePath(relative(sourceRoot, entryPath));
|
|
||||||
entries[extension === '.js' ? relativePath.slice(0, -extension.length) : relativePath] = entryPath;
|
|
||||||
|
|
||||||
if (isStyle) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user