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 isComponentSpec = relativeSpecPath.startsWith(`${config.paths.components}/`);
|
||||
|
||||
for (const extension of ['.scss', '.css', '.js']) {
|
||||
const isStyle = styleExtensions.includes(extension);
|
||||
|
||||
if (isComponentSpec && isStyle) {
|
||||
continue;
|
||||
if (!isComponentSpec) {
|
||||
const styleEntry = findFirstExistingStyle(
|
||||
sourceRoot,
|
||||
normalizePath(relative(sourceRoot, join(componentDir, `${stem}.css`)))
|
||||
);
|
||||
if (styleEntry) {
|
||||
entries[normalizePath(styleEntry.relativePath)] = styleEntry.absolutePath;
|
||||
}
|
||||
}
|
||||
|
||||
const entryPath = join(componentDir, `${stem}${extension}`);
|
||||
if (!existsSync(entryPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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;
|
||||
const scriptPath = join(componentDir, `${stem}.js`);
|
||||
if (existsSync(scriptPath)) {
|
||||
if (!isComponentSpec || hasRuntimeSelfRegistration(scriptPath)) {
|
||||
const relativePath = normalizePath(relative(sourceRoot, scriptPath));
|
||||
entries[relativePath.slice(0, -extname(relativePath).length)] = scriptPath;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user