diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 807e3cc9..fd22fda3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -77,4 +77,6 @@ jobs:
- run: pnpm install --frozen-lockfile
+ - run: pnpm build
+
- run: pnpm test
diff --git a/tests/cases/gts/comment-with-template.gts b/tests/cases/gts/comment-with-template.gts
new file mode 100644
index 00000000..ba3ccab6
--- /dev/null
+++ b/tests/cases/gts/comment-with-template.gts
@@ -0,0 +1,4 @@
+// A comment before template
+
+ hello
+
diff --git a/tests/unit-tests/__snapshots__/format.test.ts.snap b/tests/unit-tests/__snapshots__/format.test.ts.snap
index 41951c2a..514229c9 100644
--- a/tests/unit-tests/__snapshots__/format.test.ts.snap
+++ b/tests/unit-tests/__snapshots__/format.test.ts.snap
@@ -295,6 +295,14 @@ const three = {{if true "true"}};
"
`;
+exports[`format > config > default > it formats ../cases/gts/comment-with-template.gts 1`] = `
+"// A comment before template
+
+ hello
+
+"
+`;
+
exports[`format > config > default > it formats ../cases/gts/complex.gts 1`] = `
"import { on } from "@ember/modifier";
import { service } from "@ember/service";
diff --git a/tests/unit-tests/build-externals.test.ts b/tests/unit-tests/build-externals.test.ts
new file mode 100644
index 00000000..d763baf9
--- /dev/null
+++ b/tests/unit-tests/build-externals.test.ts
@@ -0,0 +1,32 @@
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+
+import { describe, expect, test } from 'vitest';
+
+describe('build externals', () => {
+ const distributionPath = path.resolve(
+ import.meta.dirname,
+ '../../dist/prettier-plugin-ember-template-tag.js',
+ );
+
+ test('prettier/plugins/estree is externalized, not bundled', () => {
+ const distribution = readFileSync(distributionPath, 'utf8');
+
+ // The dist should reference estree as an external dependency (require or import)
+ expect(distribution).toMatch(
+ /require\(["']prettier\/plugins\/estree["']\)|from\s+["']prettier\/plugins\/estree["']/,
+ );
+
+ // The dist should NOT contain estree printer internals (canAttachComment is
+ // a function from the estree printer that would be present if bundled)
+ expect(distribution).not.toMatch(/function\s+\w*canAttachComment/);
+ });
+
+ test('prettier/plugins/babel is externalized, not bundled', () => {
+ const distribution = readFileSync(distributionPath, 'utf8');
+
+ expect(distribution).toMatch(
+ /require\(["']prettier\/plugins\/babel["']\)|from\s+["']prettier\/plugins\/babel["']/,
+ );
+ });
+});
diff --git a/tests/unit-tests/config/__snapshots__/semi-false.test.ts.snap b/tests/unit-tests/config/__snapshots__/semi-false.test.ts.snap
index 0fc42c7d..fb4527d1 100644
--- a/tests/unit-tests/config/__snapshots__/semi-false.test.ts.snap
+++ b/tests/unit-tests/config/__snapshots__/semi-false.test.ts.snap
@@ -295,6 +295,14 @@ const three = {{if true "true"}}
"
`;
+exports[`config > semi: false > it formats ../cases/gts/comment-with-template.gts 1`] = `
+"// A comment before template
+
+ hello
+
+"
+`;
+
exports[`config > semi: false > it formats ../cases/gts/complex.gts 1`] = `
"import { on } from "@ember/modifier"
import { service } from "@ember/service"
diff --git a/tests/unit-tests/config/__snapshots__/template-export-default.test.ts.snap b/tests/unit-tests/config/__snapshots__/template-export-default.test.ts.snap
index c10016e6..e64fd9b4 100644
--- a/tests/unit-tests/config/__snapshots__/template-export-default.test.ts.snap
+++ b/tests/unit-tests/config/__snapshots__/template-export-default.test.ts.snap
@@ -295,6 +295,14 @@ const three = {{if true "true"}};
"
`;
+exports[`config > templateExportDefault: true > it formats ../cases/gts/comment-with-template.gts 1`] = `
+"// A comment before template
+
+ hello
+
+"
+`;
+
exports[`config > templateExportDefault: true > it formats ../cases/gts/complex.gts 1`] = `
"import { on } from "@ember/modifier";
import { service } from "@ember/service";
diff --git a/vite.config.mjs b/vite.config.mjs
index 416cc616..9694b6b6 100644
--- a/vite.config.mjs
+++ b/vite.config.mjs
@@ -6,8 +6,8 @@ export default defineConfig({
external: [
'content-tag',
'prettier',
- 'prettier/plugins/estree.js',
- 'prettier/plugins/babel.js',
+ 'prettier/plugins/estree',
+ 'prettier/plugins/babel',
],
},
lib: {