diff --git a/packages/nuxt/src/common/snippets.ts b/packages/nuxt/src/common/snippets.ts index 9086172387a7..fb84f21417e6 100644 --- a/packages/nuxt/src/common/snippets.ts +++ b/packages/nuxt/src/common/snippets.ts @@ -1,16 +1,20 @@ import * as fs from 'fs'; import * as path from 'path'; -// todo: tests /** Returns an import snippet */ export function buildSdkInitFileImportSnippet(filePath: string): string { const posixPath = filePath.split(path.sep).join(path.posix.sep); - return `import "${posixPath}";`; + // normalize to forward slashed for Windows-based systems + const normalizedPath = posixPath.replace(/\\/g, '/'); + + return `import '${normalizedPath}';`; } -// todo: tests -/** Adds an import statement right after