Closed limsbeheer closed 1 year ago
In a Windows .NET 7.0 webapplication there are two JavaScript modules:
sub.js:
export default () => console.log('default'); export const foo = () => console.log('foo');
main.js:
import bar, { foo } from './sub.js'; bar(), foo();
In Index.cshtml the main module is called:
... <script type="module" async="async"> import '/js/main.js'; </script> ...
Both files are minified with WebOptimizer version 3.0.372 in Program.cs:
... builder.Services.AddWebOptimizer(pipeline => pipeline.MinifyJsFiles("/js/main.js", "/js/sub.js")); ...
sub.js is correctly minified:
export default()=>console.log("default");export const foo=()=>console.log("foo")
main.js is not minified and errors are displayed:
/* input(1,11-12): run-time error JS1332: Expected "from": , input(1,11-12): run-time error JS1333: Expected string literal: , input(1,11): run-time error JS1004: Expected ';' input(1,11-12): run-time error JS1195: Expected expression: , input(1,25): run-time error JS1004: Expected ';' input(1,1-11): run-time error JS1328: Import statement must include module name: import bar */ import bar, { foo } from './sub.js'; bar(), foo();
With property IgnoreAllErrors = true the incorrectly minified response is visible:
IgnoreAllErrors = true
import bar from;foo;from;bar();foo()
The import statement with both default and named export gets corrupted.
Is a NUglify issue.
Setup
In a Windows .NET 7.0 webapplication there are two JavaScript modules:
sub.js:
main.js:
In Index.cshtml the main module is called:
Both files are minified with WebOptimizer version 3.0.372 in Program.cs:
Result
sub.js is correctly minified:
main.js is not minified and errors are displayed:
With property
IgnoreAllErrors = true
the incorrectly minified response is visible:The import statement with both default and named export gets corrupted.