src/index.js
function prodHandler(curPath, opts, importPath, jsFilename, template, t){
    var absPath = resolve(importPath, jsFilename)

    const cssStr = fse.readFileSync(absPath).toString()
    const {styles: obj} = createStylefromCode(cssStr, absPath)
    const cssObj = convertStylesToRNCSS(obj)

    var defautIdenti = curPath.node.specifiers[0].local.name
    const buildNode = template('const STYLES = STYOBJ;', { sourceType: 'module' })
    const styleExpre = buildNode({
        STYLES: t.identifier(defautIdenti),
        STYOBJ: t.identifier(cssObj)
    })

    curPath.replaceWith(styleExpre)
}
function prodHandler(curPath, opts, importPath, jsFilename, template, t){
    var absPath = resolve(importPath, jsFilename)

    const cssStr = fse.readFileSync(absPath).toString()
    const {styles: obj} = createStylefromCode(cssStr, absPath)
    const cssObj = convertStylesToRNCSS(obj)

    var defautIdenti = curPath.node.specifiers[0].local.name
    const buildNode = template('const STYLES = STYOBJ;', { sourceType: 'module' })
    const styleExpre = buildNode({
        STYLES: t.identifier(defautIdenti),
        STYOBJ: t.identifier(cssObj)
    })

    curPath.replaceWith(styleExpre)
}
function prodHandler ( curPath , opts , importPath , jsFilename , template , t ) { var absPath = resolve ( importPath , jsFilename ) const cssStr = fse . readFileSync ( absPath ) . toString ( ) const { styles : obj } = createStylefromCode ( cssStr , absPath ) const cssObj = convertStylesToRNCSS ( obj ) var defautIdenti = curPath . node . specifiers [ 0 ] . local . name const buildNode = template ( 'const STYLES = STYOBJ;' , { sourceType : 'module' } ) const styleExpre = buildNode ( { STYLES : t . identifier ( defautIdenti ) , STYOBJ : t . identifier ( cssObj ) } ) curPath . replaceWith ( styleExpre ) }
In prod, the js's object which is generated by the ralated css file will write directly in the js file.
@param curPath
@param opts
@param importPath
@param jsFilename
@param template
@param t
In prod the js s object which is generated by the ralated css file will write directly in the js file .