简体   繁体   中英

How do i keep dart names (variables, constants, objects ) using dart2js commands?

I'm trying to compile a dart project by using the command

pub build

However, this will generate random identifiers for all objects, which will ruin all logging information when it prints the object name.

For example, "Object = K1" is printed instead of "Object = Mirror".

Is there a way to keep all dart names, while compiling to .js ?

I also tried:

pub build --mode=debug

...but the downside is that for production builds, debug mode is now allowed.

Is there any production build approach for this issue?

You can disable minification in pubspec.yaml:

transformers:
- $dart2js:
  minify: false

See here for more details about the pub transformer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM