Skip to content

Commit

Permalink
add debugger flag for non production builds in Elm (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim-Filimonov authored and devongovett committed Nov 8, 2018
1 parent d8ddcaf commit 3bc7062
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/parcel-bundler/src/assets/ElmAsset.js
Expand Up @@ -40,6 +40,7 @@ class ElmAsset extends Asset {
await this.getConfig(['elm.json'], {load: false});
}

options.debug = !this.options.production;
if (this.options.minify) {
options.optimize = true;
}
Expand Down
17 changes: 17 additions & 0 deletions packages/core/parcel-bundler/test/elm.js
Expand Up @@ -14,6 +14,23 @@ describe('elm', function() {
let output = await run(b);
assert.equal(typeof output().Elm.Main.init, 'function');
});
it('should produce a elm bundle with debugger', async function() {
let b = await bundle(__dirname + '/integration/elm/index.js');

await run(b);
let js = await fs.readFile(__dirname + '/dist/index.js', 'utf8');
assert(js.includes('elm$browser$Debugger'));
});

it('should remove debugger in production', async function() {
let b = await bundle(__dirname + '/integration/elm/index.js', {
production: true
});

await run(b);
let js = await fs.readFile(__dirname + '/dist/index.js', 'utf8');
assert(!js.includes('elm$browser$Debugger'));
});

it('should minify Elm in production mode', async function() {
let b = await bundle(__dirname + '/integration/elm/index.js', {
Expand Down

0 comments on commit 3bc7062

Please sign in to comment.