diff --git a/packages/@lwc/rollup-plugin/src/index.ts b/packages/@lwc/rollup-plugin/src/index.ts index 6004939ad1..6712395a4b 100644 --- a/packages/@lwc/rollup-plugin/src/index.ts +++ b/packages/@lwc/rollup-plugin/src/index.ts @@ -332,7 +332,7 @@ export default function lwc(pluginOptions: RollupLwcOptions = {}): Plugin { const [namespace, name] = // Note we do not need to use path.sep here because this filename contains // a '/' regardless of Windows vs Unix, since it comes from the Rollup `id` - specifier?.split('/') ?? path.dirname(filename).split('/').slice(-2); + specifier?.split('/') ?? path.dirname(filename).split(/[\\/]/).slice(-2); /* v8 ignore next */ if (!namespace || !name) {