Skip to content

Commit 376fa55

Browse files
authored
Merge pull request #62 from emberjs/default-compiler-path
Provide a default compilerPath
2 parents bbd39fc + c9675bb commit 376fa55

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ interface Options {
4444
compiler?: EmberTemplateCompiler;
4545

4646
// The on-disk path to the ember-template-compiler.js module for our current
47-
// ember version. You need to either set `compilerPath` or set `compiler`.
47+
// ember version. You may set `compilerPath` or set `compiler`.
4848
// This will get resolved from the current working directory, so a package name
49-
// like "ember-source/dist/ember-template-compiler" is acceptable.
49+
// like "ember-source/dist/ember-template-compiler" (the default value) is acceptable.
5050
compilerPath?: string;
5151

5252
// Allows you to remap what imports will be emitted in our compiled output. By

src/node-main.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ export * from './public-types';
1010
export type Transform = ExtendedPluginBuilder | string | [string, unknown];
1111

1212
export type Options = Omit<SharedOptions, 'transforms' | 'compiler'> & {
13-
// The on-disk path to the ember-template-comipler.js module for our current
14-
// ember version. You need to either set `compilerPath` or set `compiler`.
13+
// The on-disk path to the ember-template-compiler.js module for our current
14+
// ember version. You can set either `compilerPath` or set `compiler`. If you
15+
// set neither, we will attempt to resolve
16+
// "ember-source/dist/ember-template-compiler.js" from the current working
17+
// directory.
1518
compilerPath?: string;
1619

1720
// The ember-template-compiler.js module that ships within your ember-source
18-
// version. You need to set either `compilerPath` or `compiler`.
21+
// version. You can set either `compilerPath` or `compiler`.
1922
compiler?: EmberTemplateCompiler;
2023

2124
// List of custom transformations to apply to the handlebars AST before
@@ -42,6 +45,10 @@ function handleNodeSpecificOptions(opts: Options): SharedOptions {
4245
} else if (opts.compiler) {
4346
assertTemplateCompiler(opts.compiler);
4447
compiler = opts.compiler;
48+
} else {
49+
let mod: any = cwdRequire('ember-source/dist/ember-template-compiler.js');
50+
assertTemplateCompiler(mod);
51+
compiler = mod;
4552
}
4653

4754
let transforms = [];

0 commit comments

Comments
 (0)