Skip to content

Commit 5d01843

Browse files
fix: always use / when splitting filename to get name and namespace (#5038)
Co-authored-by: Nolan Lawson <[email protected]>
1 parent d10cdb0 commit 5d01843

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/@lwc/rollup-plugin/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ export default function lwc(pluginOptions: RollupLwcOptions = {}): Plugin {
328328
// Specifier will only exist for modules with alias paths.
329329
// Otherwise, use the file directory structure to resolve namespace and name.
330330
const [namespace, name] =
331-
specifier?.split('/') ?? path.dirname(filename).split(path.sep).slice(-2);
331+
// Note we do not need to use path.sep here because this filename contains
332+
// a '/' regardless of Windows vs Unix, since it comes from the Rollup `id`
333+
specifier?.split('/') ?? path.dirname(filename).split('/').slice(-2);
332334

333335
const apiVersionToUse = getAPIVersionFromNumber(apiVersion);
334336

0 commit comments

Comments
 (0)