Allow named imports with names `Storage`, `Plugin` and more.
prateekbh opened this issue · 4 comments
Closure throws an error if it sees a class named Storage
or Plugin
.
This might be fine as one can argue that it is a reserved word. But if these classes are a part of my imports and not global definitions, it should be a clear indication that we can safely mangle this.
What's the issue?
Closure throws error.
How do we reproduce the issue?
file-A:
export class Plugin {
}
file-B:
import {Plugin} from './file-A`
const p = new Plugin();
Run ☝️ this, with rollup-plugin-closure-compiler.
On another thought:
May be we can expose a config where user can just specify what other names do they want to be mangled before CC looks at the code
I also see this with names like Console
and Location
, that the Angular libraries declare classes for. This sounds like the kind of thing assume_function_wrapper
(which is set by default with this plugin) should account for.
Looks like the Closure folks are investigating a flag that would remedy this issue for the rollup plugin.
I'd prefer to use the flag instead of manual mangling like attempted in #105.
WRT mangling, @rollup/plugin-replace
can be used to rename the problematic class names. It's not a real generic solution though.