Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debugger flag for non production builds in Elm #2225

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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