blutorange / closure-compiler-maven-plugin

Combine and minimize JavaScript with Closure Compiler.
http://blutorange.github.com/closure-compiler-maven-plugin
Apache License 2.0
52 stars 6 forks source link

skipMerge v.s. javascript imports #67

Closed grantsunny closed 1 week ago

grantsunny commented 5 months ago

The situation is, we have a setup of js files import each other like this and they cannot pass the compile with skipMerge indicator.

//common.js
export function foo {
}

//client.js
import {foo} from "./common.js";

It keep reporting this problem when minfying client.js: ERROR - [JSC_JS_MODULE_LOAD_WARNING] Failed to load module "./common.js"

I tried to test it with the closure-compiler.jar with myself, finding that it does not naturally support skipMerge. I am now assuming that the skipMerge is implemented simply by calling the command line with --js parameter multiple times (or similar). This could work only when there is no import relationship between js files, but in the reported above situation.

I don't have a clue on how to handle that for now - but this might help for your experts to follow up in upcoming releases. I understand until Google support skipMerge natively this can be hard, though.

blutorange commented 2 months ago

For reference, what is the expected output? Do you want to preserve the imports / exports as-is, just minify the content? That seems related to google/closure-compiler#3740

blutorange commented 1 week ago

For reference, skipMerge is basically just a shortcut for minifying multiple files individually. Closing this for now, as there does not seem anything I can do.