wwayne/es6-enum

TypeError on production build with webpack

roboslone opened this issue · 4 comments

When I build my project in dev mode with webpack everything works fine. But when I build in production mode (NODE_ENV=production webpack -p), I get TypeError: Cannot convert a Symbol value to a string.

To clarify, I'm converting symbol to a string using toString() method.

@roboslone How you use the es6-enum? can you give me some code samples?

Somewhat like that:

import Enum from 'es6-enum'

export class MyClass {
    static State = Enum(
        'ONLINE',
        'OFFLINE',
        'UPDATING',
    )
}

MyClass.State.ONLINE.toString()

@roboslone I googled around but I still have no idea, for this lib, it should never return such error, someone got this error because of the framework restriction, no idea if it is related

Well, we had to switch to enumify and it fixed the issue. Not sure how, though.