Red de conocimiento informático - Problemas con los teléfonos móviles - Cómo escribir webpack.config.js en React es6

Cómo escribir webpack.config.js en React es6

Consulte el ejemplo en github:

'use estricto';

let opts = require('./configopts.json'); *

* Obtener configuración

* @param configuración {String}

* @return configuración {Mixed} o nulo si no se encuentra

*/

let getSetting = (configuración) =gt; {

return opts[configuración] ! == undefinido ? opts[setting] : null

}

/**

* Obtener las opciones para la configuración dada

* @param {String} configuración

* @return resultado {Mixto}, vacío si no se encuentra. El resultado, si no se encuentra, devuelve nulo

*/

let getChoices = function getChoices(setting) {

let config = getSetting(setting)

let config = getSetting(setting); p>

devolver configuración amp; Array.isArray(config.options) ? config.options: null

}

}

/ **

* Obtenga la selección deseada a través de palabras clave

* @param {String} configuración

* @param {String} clave

* @return {Object}

/**

* Devuelve la palabra clave configurada.

*/

let getChoiceByKey = (configuración, clave) =gt; {

let options = getChoices(configuración); if(!choices) {

return null;

}

let result = null

for(let elección de opciones) {

if(choice.name === clave) {

resultado = elección

descanso

}

}

Devolver resultado

}

/**

* Obtener las opciones predeterminadas de configuración

* @param {String} configuración

* @return {Mixto} valor de retorno.

*/

let getDefaultChoice = (configuración) =gt; {

let config = getSetting(configuración)

return config; amp; config.default ! == indefinido amp; config.default.length gt; 0 ?}

// getChoices

// getDefault

módulo. exports = {

getSetting: getSetting,

getChoices: getChoices,

getChoiceByKey: getChoiceByKey,

getDefaultChoice: getDefaultChoice

};

.