Skip to content

Commit

Permalink
fix broken transform when flags are complex object
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophP committed Nov 18, 2020
1 parent 473a7c9 commit c423bf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const toESModule = js => {
const elmExports = js.match(/^_Platform_export\(([^]*?)\);/m)[1];
const elmExports = js.match(/^_Platform_export\(([^]*)\);}\(this\)\);/m)[1];
return js
.replace(/^\(function\(scope\)\{$/m, "// -- $&")
.replace(/^'use strict';$/m, "// -- $&")
.replace(/function _Platform_export([^]*?)\n\}\n/g, "/*\n$&\n*/")
.replace(/function _Platform_mergeExports([^]*?)\n\}\n/g, "/*\n$&\n*/")
.replace(/^_Platform_export\(([^]*?);$/m, "/*\n$&\n*/")
.replace(/^_Platform_export\(([^]*?)\(this\)\);$/m, '/*\n$&\n*/')
.concat("\n")
.concat(`export const Elm = ${elmExports};\n`);
};
Expand Down

0 comments on commit c423bf1

Please sign in to comment.