-
Notifications
You must be signed in to change notification settings - Fork 962
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
Bun build failed: SyntaxError: Unexpected keyword 'export' #2772
Comments
I don’t think it will be easy to migrate from babel to bun sadly. Even if mjml works perfectly fine with bun.On 6 Nov 2023, at 13:14, Alexej Kloos ***@***.***> wrote:
Describe the bug
Not possible to build via bun.
To Reproduce
Create a file:
import mjml2html from "mjml";
/*
Compile an mjml string
*/
const htmlOutput = mjml2html(
`
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-text>
Hello World!
</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
`,
);
/*
Print the responsive HTML generated and MJML errors if any
*/
console.log(htmlOutput);
Build
bun build --sourcemap=external --target=bun ./src/test.ts --outdir ./build && bun run ./build/test.js
Expected behavior
test.js 3076.02 KB
test.js.map 5568.02 KB
[107ms] bundle 665 modules
SyntaxError: Unexpected keyword 'export'
at .../api/build/test.js:70860
error: script "testfile" exited with code 1 (SIGHUP)
Line 70860:
exports.FILES = [
"......../api/node_modules/uglify-js/tools/exports.js"
];
new Function("domprops", "exports", function() {
var code = exports.FILES.map(function(file) {
return fs.readFileSync(file, "utf8");
});
code.push("exports.describe_ast = " + describe_ast.toString());
return code.join("\n\n");
}())(require_domprops(), exports);
if (+process.env["UGLIFY_BUG_REPORT"]) {
var $minify = function(files, options) {
if (typeof options == "undefined")
options = "<<undefined>>";
var code = [
"// UGLIFY_BUG_REPORT",
to_comment(options)
];
if (typeof files == "string") {
code.push("");
code.push("//-------------------------------------------------------------");
code.push("// INPUT CODE", files);
} else
for (var name in files) {
code.push("");
code.push("//-------------------------------------------------------------");
code.push(to_comment(name), files[name]);
}
if (options.sourceMap && options.sourceMap.url) {
code.push("");
code.push("//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9");
}
var result = { code: code.join("\n") };
if (options.sourceMap)
result.map = '{"version":3,"sources":[],"names":[],"mappings":""}';
return result;
};
export { $minify as minify };
}
What the hell is export { $minify as minify }; ?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
The package uglify-js has follow dependency: The package https://github.com/kangax/html-minifier would not be maintained. The last version ist from Apr 1, 2019 👎 |
Script flow:
I think if uglify-js is fixed. Than it will work. I made some test that can be work 👍 |
Ohh last update of https://github.com/mishoo/UglifyJS/ was: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Not possible to build via bun.
To Reproduce
bun build --sourcemap=external --target=bun ./src/test.ts --outdir ./build && bun run ./build/test.js
Expected behavior
Line 70860:
What the hell is export { $minify as minify }; ?
The text was updated successfully, but these errors were encountered: