Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ interface EmberCLIBabelConfig {
exclude?: string[];
useBuiltIns?: boolean;
sourceMaps?: boolean | "inline" | "both";
retainLines?: boolean;
plugins?: BabelPlugin[];
};

Expand Down Expand Up @@ -171,6 +172,22 @@ let app = new EmberApp(defaults, {
});
```

#### Enabling Retain Lines

Babel generated source maps will enable you to debug your original ES6 source code. This is disabled by default because this will lead to wacky code but is handy for scenarios where you can't use source maps or breakpoints in external debugger are offset (vscode has this issue, see the extension https://github.com/Microsoft/vscode-chrome-debug)

To enable it, pass `retainLines: true` in your `babel` options.

```js
// ember-cli-build.js

var app = new EmberApp(defaults, {
babel: {
retainLines: true
}
});
```

#### Modules

Older versions of Ember CLI (`< 2.12`) use its own ES6 module transpiler.
Expand Down
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,16 @@ module.exports = {
sourceMaps = config.babel.sourceMaps;
}

let retainLines = false;
if (config.babel && "retainLines" in config.babel) {
retainLines = config.babel.retainLines;
}

let options = {
annotation: providedAnnotation || `Babel: ${this._parentName()}`,
sourceMaps,
throwUnlessParallelizable
throwUnlessParallelizable,
retainLines
};

let userPlugins = addonProvidedConfig.plugins;
Expand Down
7 changes: 7 additions & 0 deletions node-tests/addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,13 @@ describe('ember-cli-babel', function() {
expect(result.sourceMaps).to.equal('inline');
});

it("uses provided retainLines if specified", function() {
let options = { babel: { retainLines: true } };

let result = this.addon.buildBabelOptions(options);
expect(result.retainLines).to.equal(true);
});

it('does not include all provided options', function() {
let babelOptions = { blah: true };
let options = {
Expand Down